vercel / next.js

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

`webpackPrefetch: true` magic comment doesn't work in next v15.0.3 #73090

Open gavrilikhin-d opened 6 days ago

gavrilikhin-d commented 6 days ago

Link to the code that reproduces this issue

https://github.com/gavrilikhin-d/repro

To Reproduce

Test prefetching in production mode

  1. 
    npm install
    npm run build
    npm run start
  2. Open http://localhost:3000
  3. Open the Network tab in the browser's developer tools
  4. Click on the "Load Dynamic Component"
  5. See no prefetching happening

Current vs. Expected behavior

Prefetching should work

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 24.1.0: Thu Oct 10 21:05:14 PDT 2024; root:xnu-11215.41.3~2/RELEASE_ARM64_T8103
  Available memory (MB): 8192
  Available CPU cores: 8
Binaries:
  Node: 22.9.0
  npm: 10.8.3
  Yarn: 1.22.22
  pnpm: N/A
Relevant Packages:
  next: 15.0.3 // Latest available version is detected (15.0.3).
  eslint-config-next: N/A
  react: 19.0.0-rc-66855b96-20241106
  react-dom: 19.0.0-rc-66855b96-20241106
  typescript: 5.6.3
Next.js Config:
  output: N/A

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

Lazy Loading, Webpack

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

next build (local), next start (local)

Additional context

Broken since 15.0.3-canary.7, because on 15.0.3-canary.6 it works

gavrilikhin-d commented 6 days ago

Note that webpackChunkName works even on 15.0.3

gavrilikhin-d commented 6 days ago

It could be related to webpack bump https://github.com/vercel/next.js/pull/72290