Next.js Discord

Discord Forum

Help Needed with ChunkLoadError in my Next.js App

Unanswered
CyberNinja posted this in #help-forum
Open in Discord
Hi,

So, I'm getting slammed with a ChunkLoadError that's totally throwing off my vibes. Whenever I run my app, I see this error message popping up in the browser, "ChunkLoadError: Loading chunk [chunkName] failed. (error: [errorMessage])"

After some serious detective work, I realized that my next.config.js file is feeling kinda empty, like a barren wasteland, with no webpack configurations to handle the dynamic imports and code splitting my app needs.

I was hoping you could hook me up with some guidance on how to pimp out my webpack config in Next.js. I'm all about that code-splitting goodness and resolving this ChunkLoadError headache. I'm unsure about the webpack rules for loading files and processing SCSS.

Just to keep you in the loop, here's what my next.config.js file is currently looking':

/** @type {import('next').NextConfig} */
const nextConfig = {
  experimental: {
    appDir: true,
  }
}

module.exports = nextConfig

2 Replies

I've made some googling about this error, they all accused a caching related error. So had to delete the .next folder, stop and restart the server. The quick refresh my browser by using Ctrl + Shift + R, it works 1 time out of 10
I give up 😭