-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Description
Bug report
What is the current behavior?
Certain chunk requests use undefined instead of the hash. Example of the resulting error in chrome:
Uncaught (in promise) Error: Loading chunk 63 failed.
(error: https://{hostname}/app/63.undefined.feasContentHashV1.chunk.js)
at HTMLScriptElement.i ({appName}.d5b0c78176fe6ff82a0f.bundle.js:1)
The request for chunk 63 looks like this:
https://{hostname}/app/63.undefined.chunk.js
Stepping through the webpack build, it appears as though the function getScriptSrcPath in JsonpMainTemplatePlugin.js (link) creates a mapping of chunk Id to hash. Looking at the result, the entry for the chunk Id 63 is missing entirely, resulting in the undefined hash in the request.
However, looking through the resulting build, there appears to be a valid chunk 63 with a valid hash in the file name. I'm guessing that somewhere along the line, the reference is lost to this chunk?
If the current behavior is a bug, please provide the steps to reproduce.
This is somewhat difficult to reproduce, I think its related to the total number of async chunks made by splitChunksPlugin, but I'm not 100% sure. I'm unable to reproduce a build that can do this. please let me now what other information would be useful.
I think this may be related to #7061 since the behavior sounds similar. However, according to the maintainers that bug was fixed in 4.6.0. Since we are at a later version (4.29.0) I would expect that fix to be included.
What is the expected behavior?
I would expect JsonpMainTemplatePlugin to produce code that has a valid mapping of all chunk Id's to their respective hashes, and for all requests for chunks to have defined hashes.
Other relevant information:
webpack version: 4.29.0 (I also tried linking to a develop build of webpack)
Node.js version: v8.11.1
Operating System: MacOS
Additional tools: