Why you will see the error "Loading chunk \d+ failed"
Clarice Bouwer

Clarice Bouwer @cbillowes

About: Curious programmer sharing byte-sized knowledge on dev.to. Passionate about Git, GCP, TypeScript, Next.js, and DevTools. Enjoys collaborating with others and leading by example.

Location:
Mauritius
Joined:
May 30, 2018

Why you will see the error "Loading chunk \d+ failed"

Publish Date: Sep 6 '22
0 0

I know of the following reasons why chunks cannot be downloaded:

  • network errors: inspect the network in the browser dev tools to find out more information about the errors.

  • resources not found: they don't exist in the correct directory (output > publicPath). Try access the resource/asset via its URL in the browser to see if it exists.

  • package corruption: something is wonky with the node_modules. In my case, I manipulated my modules locally to avoid having to push to npm on each change. This caused corruption which resulted in chunks that did exist in the output path were deemed not found. To rectify this, delete the modules and re-install.

  • duplicate styled-components: https://styled-components.com/docs/faqs#why-am-i-getting-a-warning-about-several-instances-of-module-on-the-page

rm -rf node_modules
npm install # or `npm i` for short
Enter fullscreen mode Exit fullscreen mode

Comments 0 total

    Add comment