vercel / next.js

The React Framework
https://nextjs.org
MIT License
126.73k stars 26.94k forks source link

Specifying webpack configuration using node v23 in next config breaks next build #71911

Open dualdetail opened 6 days ago

dualdetail commented 6 days ago

Link to the code that reproduces this issue

https://github.com/dualdetail/webpack-example

To Reproduce

npm install npm run build

Screenshot 2024-10-26 212121

Current vs. Expected behavior

Currently, build prints webpack caching failure then stops building (this also prints in dev without issues). If you remove the webpack configuration from next.config.ts the build will process normally. I set it up so the next.config.ts file does not change the config but just returns the default which still fails.

Expected behavior is build will work with webpack configuration.

Provide environment information

Operating System:
  Platform: win32
  Arch: x64
  Version: Windows 11 Pro
  Available memory (MB): 98051
  Available CPU cores: 32
Binaries:
  Node: 23.0.0
  npm: N/A
  Yarn: N/A
  pnpm: N/A
Relevant Packages:
  next: 15.0.2-canary.8 // Latest available version is detected (15.0.2-canary.8).
  eslint-config-next: 15.0.2-canary.8
  react: 19.0.0-rc-1631855f-20241023
  react-dom: 19.0.0-rc-1631855f-20241023
  typescript: 5.6.3
Next.js Config:
  output: N/A

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

Webpack

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

next build (local)

Additional context

I have tried using both npm and pnpm without success. I did not get webpack.cache.PackFileCacheStrategy print out in nextjs 14.2.15 and node v23.

dualdetail commented 4 days ago

So I experimented on accident. It seems related to node v23. I was able to build the app using node v22 just fine. I tested this on a separate machine and updating to node v23 and installing libraries produces the same output (as in it doesn't build)

EugeCos commented 3 days ago

Similar problem here, build is breaking with below error after bumping Node to 23.1.0.

Error: Could not find a production build in the '.next' directory. Try building your app with 'next build' before starting the production server. https://nextjs.org/docs/messages/production-start-no-build-id
Plow74 commented 3 days ago

Having this issue as well building a Next 13.5.6 app on Node v23.

Creating an optimized production build .<w> [webpack.cache.PackFileCacheStrategy] Caching failed for pack: Error: Unable to snapshot resolve dependencies

Edit by maintainer bot: Comment was automatically minimized because it was considered unhelpful. (If you think this was by mistake, let us know). Please only comment if it adds context to the issue. If you want to express that you have the same problem, use the upvote 👍 on the issue description or subscribe to the issue for updates. Thanks!