vercel / vercel/next.js

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

Open
#73,090 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug Lazy Loading Webpack
Dominant language
JavaScript
Stars
142k
Forks
32.4k
Avg merge
2d 14h
Merged PRs (30d)
351

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the reproduction repository at https://github.com/gavrilikhin-d/repro and run npm install, npm run build, and npm run start. Use the browser Network tab while loading the dynamic component, then compare behavior between 15.0.3-canary.6, 15.0.3-canary.7, and 15.0.3. Done means webpackPrefetch: true causes the expected prefetch request in production.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nextjs, react, typescript, webpack
Domain
build-system, frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.