Open TxHawks opened 7 months ago
Looking at the call stack, it seems like the error comes from here: https://github.com/webpack/webpack/blob/23c39437617d5ff8de4120911e728b0f56a5fed5/lib/web/JsonpChunkLoadingRuntimeModule.js#L177
And when stepping through the code, the last line I could get to was the setTimeout
on line 201
here:
https://github.com/vercel/next.js/blob/canary/packages/next/src/shared/lib/loadable.shared-runtime.tsx#L196-L207
Changing installedChunkData[1](error);
to console.error(error);
in https://github.com/webpack/webpack/blob/23c39437617d5ff8de4120911e728b0f56a5fed5/lib/web/JsonpChunkLoadingRuntimeModule.js#L193 seems to superficially fix the issue and blocking the chunk no longer causes the application to crash.
while using next/dynamic do u have this type of code with your file paths in page source?. while clicking view page source.
@john-subba I'm not sure what you're asking, but I think your issue might be different and related to #64386
@TxHawks while using next/dynamic this appears in your page source. I mean to ask does this appear in your website page source too?. While clicking view page source.
You can look at the reproduction code here: https://github.com/Txhawks/missing-chunk-error
And at a deployed version of it here: https://missing-chunk-error.vercel.app/
We're facing the same. Got a lot of ChunkLoadErrors in Sentry. After the dynamic imports were removed they're gone. Waiting for a fix.
Datadog Error Tracking is also talking about the same problem.
I'm using Next^14.2.5
and some users have the same problem even though there was no web deployment.
Link to the code that reproduces this issue
https://github.com/Txhawks/missing-chunk-error
To Reproduce
The reproduction imports a
Foo
component usingnext/dynamic
. When the network request tofoo.js
fails, the whole app comes down crashing.201.e0005a340046428d.js
ChunkLoadError: Loading chunk 38 failed.
client-side error.This isn't limited to Vercel and can be reproduced locally with
next build && next start
as well.Current vs. Expected behavior
As explained above, any failure in loading a component with
next/dynamic
causes an error that is entirely irrecoverable in the client, and which crashes the entire app. Even Doing something like this doesn't help:Dynamic imports are susceptible to network flaws and causing of an irrecoverable client error for something like this makes applications extremely brittle.
Provide environment information
Which area(s) are affected? (Select all that apply)
App Router, Dynamic imports (next/dynamic)
Which stage(s) are affected? (Select all that apply)
next start (local)
Additional context
I've seen #54008, and this does seem similar, but seems to not be the same. I tried against
13.5.5
which the issue mentions, and it fails in the same way there.