Skip to content
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

Error when using experimental.workerThreads and webpack config #69096

Open
Janpot opened this issue Aug 20, 2024 · 0 comments
Open

Error when using experimental.workerThreads and webpack config #69096

Janpot opened this issue Aug 20, 2024 · 0 comments
Labels
bug Issue was opened via the bug report template. Output Related to the the output configuration option.

Comments

@Janpot
Copy link
Contributor

Janpot commented Aug 20, 2024

Link to the code that reproduces this issue

https://github.com/Janpot/next-worker-threads-repro

To Reproduce

  1. Clone https://github.com/Janpot/next-worker-threads-repro
  2. Run pnpm install
  3. Run pnpm build

The Next.js config combines custom webpack with experimental.workerThreads.

// ./next.config.mjs

/** @type {import('next').NextConfig} */
const nextConfig = {
  reactStrictMode: true,
  experimental: {
    workerThreads: true,
  },
  webpack: (config) => config,
};

export default nextConfig;

Current vs. Expected behavior

It currently throws an error:

▲ Next.js 15.0.0-canary.121
- Experiments (use with caution):
  · workerThreads

✓ Linting and checking validity of types    
 Creating an optimized production build ...
✓ Compiled successfully
✓ Collecting page data    

> Build error occurred
DOMException [DataCloneError]: (config) => config could not be cloned.
  at new DOMException (node:internal/per_context/domexception:53:5)
  at Worker.postMessage (node:internal/worker:366:5)
  at ExperimentalWorker.send (~/node_modules/.pnpm/[email protected][email protected][email protected]_2xa4b5m2p52gsklkteytl7vbtu/node_modules/next/dist/compiled/jest-worker/index.js:1:17480)
  at WorkerPool.send (~/node_modules/.pnpm/[email protected][email protected][email protected]_2xa4b5m2p52gsklkteytl7vbtu/node_modules/next/dist/compiled/jest-worker/index.js:1:6183)
  at Farm._process (~/node_modules/.pnpm/[email protected][email protected][email protected]_2xa4b5m2p52gsklkteytl7vbtu/node_modules/next/dist/compiled/jest-worker/index.js:1:2094)
  at Farm._push (~/node_modules/.pnpm/[email protected][email protected][email protected]_2xa4b5m2p52gsklkteytl7vbtu/node_modules/next/dist/compiled/jest-worker/index.js:1:2278)
  at ~/node_modules/.pnpm/[email protected][email protected][email protected]_2xa4b5m2p52gsklkteytl7vbtu/node_modules/next/dist/compiled/jest-worker/index.js:1:1712
  at new Promise (<anonymous>)
  at Farm.doWork (~/node_modules/.pnpm/[email protected][email protected][email protected]_2xa4b5m2p52gsklkteytl7vbtu/node_modules/next/dist/compiled/jest-worker/index.js:1:1257)
  at Worker._callFunctionWithArgs (~/node_modules/.pnpm/[email protected][email protected][email protected]_2xa4b5m2p52gsklkteytl7vbtu/node_modules/next/dist/compiled/jest-worker/index.js:1:23770)
 Generating static pages (0/3)  [    ] ELIFECYCLE  Command failed with exit code 1.

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 23.6.0: Mon Jul 29 21:14:21 PDT 2024; root:xnu-10063.141.2~1/RELEASE_ARM64_T8103
  Available memory (MB): 16384
  Available CPU cores: 8
Binaries:
  Node: 18.20.2
  npm: 10.5.0
  Yarn: 1.22.22
  pnpm: 9.7.1
Relevant Packages:
  next: 14.2.5 // Latest available version is detected (14.2.5).
  eslint-config-next: N/A
  react: 18.3.1
  react-dom: 18.3.1
  typescript: N/A
Next.js Config:
  output: export

Which area(s) are affected? (Select all that apply)

Output (export/standalone)

Which stage(s) are affected? (Select all that apply)

next build (local)

Additional context

Discovered in mui/material-ui#42824 (comment)

@Janpot Janpot added the bug Issue was opened via the bug report template. label Aug 20, 2024
@github-actions github-actions bot added the Output Related to the the output configuration option. label Aug 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue was opened via the bug report template. Output Related to the the output configuration option.
Projects
None yet
Development

No branches or pull requests

1 participant