Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(export): make static export work with worker_threads (#47784)
Fixes #46993. The issue is introduced in #46705 by @ijjk Next.js uses `jest-worker` for multiprocessing. `jest-worker` supports both `child_process` and `worker_threads` modes. Next.js use `child_process` mode by default, but can also switch to using `worker_threads` mode with an experimental flag `config.experimental.workerThreads`. In #46705, @ijjk applies a fix that works for the `child_process` mode, which breaks the `worker_threads` mode (`jest-worker`'s `NodeThreadWorker` interface doesn't have the private property `_child`), causing static HTML export to fail with the following error (#46993): ``` > Build error occurred TypeError: Cannot read properties of undefined (reading 'on') at createWorker (/Users/[redacted]/node_modules/next/dist/lib/worker.js:32:31) at new Worker (/Users/[redacted]/node_modules/next/dist/lib/worker.js:42:9) at /Users/[redacted]/node_modules/next/dist/build/index.js:629:35 at async Span.traceAsyncFn (/Users/[redacted]/node_modules/next/dist/trace/trace.js:79:20) at async Object.build [as default] (/Users/[redacted]/node_modules/next/dist/build/index.js:74:29) ``` The PR fixes that.
- Loading branch information