Webpack 5 worker import fails with "chunks: 'all'" + [contenthash] in output filename
See original GitHub issueBug 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 of undefined
there’s a proper content hash.
Relevant bits of configuration:
output: {
path: path.resolve(__dirname, 'wwwroot'),
publicPath,
filename: '[name].[contenthash].js',
},
optimization: {
moduleIds: 'deterministic',
splitChunks: {
chunks: 'all',
},
runtimeChunk: false,
},
The worker import code in the transpiled code I see:
return new Worker(
new URL(/* worker import */ __webpack_require__.p +
__webpack_require__.u(
"src_functions_parallelism_caching_passport-worker_ts-_36b50"), __webpack_require__.b), {
...
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:
Issue Analytics
- State:
- Created 2 years ago
- Reactions:3
- Comments:22 (11 by maintainers)
Top GitHub Comments
Marked as critical, we will fix it in near future
Please try https://github.com/webpack/webpack/releases/tag/v5.51.2