-
-
Notifications
You must be signed in to change notification settings - Fork 8.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Webpack 5 worker import fails with "chunks: 'all'" + [contenthash] in output filename #13801
Comments
Added additional context into the issue, please take a look. |
Please use |
You have invalid URL |
@alexander-akait are you sure it's a question of public path? To reiterate, the worker import was working properly before I added (In my case |
Please provide reproducible test repo, otherwise we can't help here, maybe other plugin break contenthash |
Some more context before I jump into test repo: I tried replacing The runtime still tries to import a non-existent script, but instead of I.e. the browser tries to load The "non-existent" hash is also referenced in chunk filename in the compiled code (hence the attempt to load the script from that path). Is there a way that P.S. the above also explains why I didn't have any problems when using just |
During build time, I see a warning that might be relevant:
|
It means you have plugin which break hash/contenthash/etc |
I don't know why it is hard to use the issue template and provide example how we can reproduce, this will not only make your life easier, but also reduce the time spent trying to guess, and will also save your nerves |
I used the issue template as is; re reproducible repo, agree it's not hard, just time consuming to strip down the NDA-protected codebase down to a reproducible example. Thus, I am trying to figure out the potential root cause as is first, failing that I'll work on bringing the example to the table. For the record, I managed to get rid of the above warning by updating all my plugins, the issue was not gone. I am beginning to suspect this: [webpack] WARNING in [entry]
[webpack] Circular dependency between chunks with runtime (src_functions_parallelism_caching_passport-worker_ts-_36b50, src_functions_parallelism_caching_passport-worker_ts-_36b51, src_functions_parallelism_calculation_function-worker_ts, taskpane) This error is caused by the fact that in a certain file, depending on the browser, I instantiate either a Apparently Webpack 5 cannot merge them into one chunk so I end up with two chunk bundles with identical content: By the looks of things, maybe the My working day is over, if I don't sort this problem out I am going to work on a repro. |
unfortunately there can be many problems here, I cannot help without repo 😞 |
I'm having the same issue as @wh1t3cAt1k, in conjunction with waysact/webpack-subresource-integrity. See also: waysact/webpack-subresource-integrity#165 |
I was able to make @AprilArcus even more minimal by stripping down the webpack-subresource-integrity plugin to the minimal it needs to cause this behavior. I added console.logging to |
Reproducible example https://github.com/AprilArcus/webpack-sri-workers-contenthash-repro |
Here is my investigation into this issue that lead to helping produce the minimal example: If using contenthash with a WebWorker and any plugin is calling Maintemplate.prototype.hook.localVars such as the webpack-subresource-integrity plugin, the runtime starts requesting for undefined when it tries to load the web worker chunk both observed in the console and from adding logging in webpacks source . Since this is happening as a sideeffect of calling .tap, I think the issue lies downstream of Line 365 in c181294
|
Here is another reproduction: https://github.com/kinsei0916/webpack-worker-contenthash-repro |
Marked as critical, we will fix it in near future |
Fix #14112 |
It’s working now (remcohaszing/monaco-yaml#100) 🎉 |
Let's close, feel free to feedback if you faced with bugs again |
I confirm that the issue has disappeared for me as well after the upgrade. Thank you for the fix. |
Bug report
What is the current behavior?
Worker import started producing a script loading error as soon as I added
[contenthash]
into the output filename.I see a strange 404 error in the console for a non-existent chunk script with a strange path (note the
.undefined.js
postfix):https://localhost/addin/src_functions_parallelism_caching_passport-worker_ts-_36b50.undefined.js
Where does this
.undefined.js
part come from? Does it give anyone any idea?The actual filename of the chunk that does exist after compilation is
src_functions_parallelism_caching_passport-worker_ts-_36b50.8ba2df42b53ad688d69d.js
- instead ofundefined
there's a proper content hash.Relevant bits of configuration:
The worker import code in the transpiled code I see:
Not sure if it's OK or relevant to the problem, pasting here just in case.
What is the expected behavior?
The expected behaviour is that worker import is able to resolve the correct script name (with the contenthash appended).
Other relevant information:
webpack version: 5.44.0
Node.js version: 14 LTS
Operating System: Mac OS
Additional tools:
The text was updated successfully, but these errors were encountered: