- Next v10.0.6 inlined webpack vercel/next.js#20598.
- worker-loader has webpack as peer dep https://github.com/webpack-contrib/worker-loader/blob/v3.0.7/package.json#L40-L42.
- worker-loader imports webpack https://github.com/webpack-contrib/worker-loader/blob/v3.0.7/src/index.js#L6-L35.
- webpack 5 doesn't support multiple versions installed jantimon/html-webpack-plugin#1451 (comment)
When using next.js with webpack 5 inlined and worker-loader an exception appears.
yarn
yarn build
- Desired behaviour: build to succeed.
- Current behaviour: exception
➜ bug-repro-next-w5-inline-worker git:(main) ✗ yarn build
yarn run v1.22.5
$ next build
info - Creating an optimized production build
Failed to compile.
./lib/hello.worker.js
TypeError: Cannot read property 'version' of undefined
> Build error occurred
Error: > Build failed because of webpack errors
at /Users/ramirosilveyra/dev/personal/bug-repro-next-w5-inline-worker/node_modules/next/dist/build/index.js:15:918
at async /Users/ramirosilveyra/dev/personal/bug-repro-next-w5-inline-worker/node_modules/next/dist/build/tracer.js:1:1450
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.