jest-worker 27.4.0 breaks webpack builds with node options
See original GitHub issueBug report
When latest webpack is used with latest jest - 27.4.0, it breaks production builds with custom node options. e.g.
node --max_old_space_size=2768 node_modules/webpack-cli/bin/cli.js --mode production
Result is
ERROR in 497.a3d1.js from Terser
Error [ERR_WORKER_INVALID_EXEC_ARGV]: Initiated Worker with invalid execArgv flags: --max_old_space_size=2768
at new NodeError (internal/errors.js:322:7)
at new Worker (internal/worker.js:196:13)
at ExperimentalWorker.initialize (/permissions/node_modules/jest-worker/build/workers/NodeThreadsWorker.js:149:20)
at new ExperimentalWorker (/permissions/node_modules/jest-worker/build/workers/NodeThreadsWorker.js:145:10)
at WorkerPool.createWorker (/permissions/node_modules/jest-worker/build/WorkerPool.js:44:12)
at new BaseWorkerPool (/permissions/node_modules/jest-worker/build/base/BaseWorkerPool.js:127:27)
at new WorkerPool (/permissions/node_modules/jest-worker/build/WorkerPool.js:30:1)
at new Worker (/permissions/node_modules/jest-worker/build/index.js:167:26)
at getWorker (/permissions/node_modules/terser-webpack-plugin/dist/index.js:288:9)
at /permissions/node_modules/terser-webpack-plugin/dist/index.js:389:41
Problem is with latest jest-worker. There is installed tree with npm
$ npm ls jest-worker
permissions@1.0.0 ./src
├─┬ babel-jest@27.4.0
│ └─┬ @jest/transform@27.4.0
│ └─┬ jest-haste-map@27.4.0
│ └── jest-worker@27.4.0 deduped
├─┬ jest@27.4.0
│ └─┬ @jest/core@27.4.0
│ ├─┬ @jest/reporters@27.4.0
│ │ └── jest-worker@27.4.0 deduped
│ └─┬ jest-runner@27.4.0
│ └── jest-worker@27.4.0 deduped
└─┬ webpack@5.64.4
└─┬ terser-webpack-plugin@5.1.4
└── jest-worker@27.4.0
If the current behavior is a bug, please provide the steps to reproduce.
Install latest webpack with latest jest Use some simple webpack config which utilizes production build. I can try it later for minimal setup if necessary.
What is the expected behavior?
Production builds work as expected. Lowering jest-worker dependency can be solution.
Other relevant information: webpack version: 5.64.4 Node.js version: 16.13.0 Operating System: Windows, Linux Additional tools: jest@27.4.0
Issue Analytics
- State:
- Created 2 years ago
- Reactions:8
- Comments:12 (3 by maintainers)
Top GitHub Comments
Temporary workaround - install jest-worker@27.3.* by hand. Then webpack production builds with node options works as usually.
$ npm i -D jest-worker@27.3.1
$ node --max_old_space_size=2768 node_modules/webpack-cli/bin/cli.js --mode production
But I think it’s up to webpack developers fix erroneous dependency. Or create issue on jest. It’s news to me, that jest-worker is wepback dependency.
@anagh416 @kelly-tock
They are already working on it https://github.com/facebook/jest/pull/12128