Skip to content

Update the webpack version bundled in next#89569

Draft
lukesandberg wants to merge 3 commits intocanaryfrom
bump_webpack_version
Draft

Update the webpack version bundled in next#89569
lukesandberg wants to merge 3 commits intocanaryfrom
bump_webpack_version

Conversation

@lukesandberg
Copy link
Contributor

@lukesandberg lukesandberg commented Feb 6, 2026

Upgrade webpack 5.98.0 → 5.105.0

Updates webpack from 5.98.0 to 5.105.0 and webpack-dev-server from 5.2.0 to 5.2.3.

Notable webpack changes

New Features:

  • Native tsconfig resolver option - can replace tsconfig-paths-webpack-plugin (v5.105.0)
  • import.defer() support for context modules (v5.105.0)
  • Array values for devtool option (v5.105.0)
  • Built-in DotenvPlugin and top-level dotenv option (v5.103.0)
  • Built-in WebpackManifestPlugin (v5.103.0)
  • import.meta.env, import.meta.dirname, import.meta.filename support (v5.103.0)
  • CSS exportType option (link, text, css-style-sheet) (v5.103.0)
  • New import types: { type: "bytes" } and { type: "text" } (v5.102.0)
  • Tree-shaking for ESM external modules with named imports (v5.101.0)

Stabilized (no longer experimental):

Bug Fixes & Security:

  • Security fix in HttpUriPlugin (v5.104.1)
  • Various fixes for reexport runtime calculations, module concatenation performance

webpack-dev-server 5.2.0 → 5.2.3

  • ESC key to dismiss error overlay (v5.2.3)
  • Fixed crash when error is null for runtime errors (v5.2.2)
  • Improved cross-origin request validation (v5.2.1)

HMR race condition fix

Webpack 5.104+ added a module existence check in `webpack_require` (when `output.pathinfo` is true, the default in dev mode) that surfaced a pre-existing race condition in Next.js's HMR protocol.

The race: When a server component changes, the dev server sends `BUILT` (triggering async `module.hot.apply()`) followed by `SERVER_COMPONENT_CHANGES` (triggering `hmrRefresh()`). Previously, `hmrRefresh()` fired immediately without waiting for the webpack update to finish, so `webpack_require` could be called for client components that were temporarily absent from `webpack_modules` during the swap. This was silently caught by React error boundaries with old webpack, but the new explicit module existence check turns it into a hard error.

The fix: Wait for the pending webpack HMR promise to resolve before calling `hmrRefresh()`, ensuring all modules are fully in place before the RSC response references them.

Known Breaking changes

Breaking change for `experimental.urlImports` users: Webpack 5.105.0 now validates redirect target URLs against the `allowedUris` policy. If your URL imports redirect to a different domain (e.g., `github.com/...` → `raw.githubusercontent.com/...`), you must add the redirect target domain to your `urlImports` array.

Full changelogs

Blocked on webpack/webpack#20475

Fixes #89177

@nextjs-bot nextjs-bot added created-by: Turbopack team PRs by the Turbopack team. type: next labels Feb 6, 2026
Copy link
Contributor Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@lukesandberg lukesandberg changed the title bump the webpack version bundled in next Update the webpack version bundled in next Feb 6, 2026
@nextjs-bot
Copy link
Collaborator

nextjs-bot commented Feb 6, 2026

Failing test suites

Commit: 2608499 | About building and testing Next.js

pnpm test-dev test/development/app-dir/hmr-iframe/hmr-iframe.test.ts (job)

  • app-dir hmr-env > should update server components pages when env files is changed (edge) (DD)
  • app-dir hmr-env > should update server components pages when env files is changed (edge-module-var) (DD)
Expand output

● app-dir hmr-env › should update server components pages when env files is changed (edge)

expect(received).toBe(expected) // Object.is equality

Expected: "ipad"
Received: "mac"

  19 |       await next.patchFile(envFile, 'MY_DEVICE="ipad"', async () => {
  20 |         await retry(async () => {
> 21 |           expect(await browser.elementByCss('p').text()).toBe('ipad')
     |                                                          ^
  22 |         })
  23 |       })
  24 |

  at toBe (development/app-hmr/hmr-env.test.ts:21:58)
  at retry (lib/next-test-utils.ts:831:14)
  at development/app-hmr/hmr-env.test.ts:20:9
  at NextDevInstance.patchFile (lib/next-modes/base.ts:729:9)
  at NextDevInstance.patchFile (lib/next-modes/next-dev.ts:303:16)
  at development/app-hmr/hmr-env.test.ts:19:7

● app-dir hmr-env › should update server components pages when env files is changed (edge-module-var)

expect(received).toBe(expected) // Object.is equality

Expected: "ipad"
Received: "mac"

  19 |       await next.patchFile(envFile, 'MY_DEVICE="ipad"', async () => {
  20 |         await retry(async () => {
> 21 |           expect(await browser.elementByCss('p').text()).toBe('ipad')
     |                                                          ^
  22 |         })
  23 |       })
  24 |

  at toBe (development/app-hmr/hmr-env.test.ts:21:58)
  at retry (lib/next-test-utils.ts:831:14)
  at development/app-hmr/hmr-env.test.ts:20:9
  at NextDevInstance.patchFile (lib/next-modes/base.ts:729:9)
  at NextDevInstance.patchFile (lib/next-modes/next-dev.ts:303:16)
  at development/app-hmr/hmr-env.test.ts:19:7

pnpm test-dev test/development/app-hmr/hmr.test.ts (job)

  • app-dir-hmr > filesystem changes > should update server components after navigating to a page with a different runtime (DD)
Expand output

● app-dir-hmr › filesystem changes › should update server components after navigating to a page with a different runtime

expect(received).toBe(expected) // Object.is equality

Expected: "ipad"
Received: "mac"

  74 |         // little slow (especially on overloaded CI servers)
  75 |         await retry(async () => {
> 76 |           expect(await browser.elementByCss('p').text()).toBe('ipad')
     |                                                          ^
  77 |         }, 5000 /* ms */)
  78 |
  79 |         expect(await browser.eval('window.__TEST_NO_RELOAD === true')).toBe(

  at toBe (development/app-hmr/hmr.test.ts:76:58)
  at retry (lib/next-test-utils.ts:831:14)
  at development/app-hmr/hmr.test.ts:75:9
  at NextDevInstance.patchFile (lib/next-modes/base.ts:729:9)
  at NextDevInstance.patchFile (lib/next-modes/next-dev.ts:303:16)
  at Object.<anonymous> (development/app-hmr/hmr.test.ts:70:7)

@nextjs-bot
Copy link
Collaborator

nextjs-bot commented Feb 6, 2026

Stats from current PR

🔴 1 regression

Metric Canary PR Change Trend
node_modules Size 472 MB 472 MB 🔴 +313 kB (+0%) ▁████
📊 All Metrics
📖 Metrics Glossary

Dev Server Metrics:

  • Listen = TCP port starts accepting connections
  • First Request = HTTP server returns successful response
  • Cold = Fresh build (no cache)
  • Warm = With cached build artifacts

Build Metrics:

  • Fresh = Clean build (no .next directory)
  • Cached = With existing .next directory

Change Thresholds:

  • Time: Changes < 50ms AND < 10%, OR < 2% are insignificant
  • Size: Changes < 1KB AND < 1% are insignificant
  • All other changes are flagged to catch regressions

⚡ Dev Server

Metric Canary PR Change Trend
Cold (Listen) 455ms 456ms ▁▁▁▁▁
Cold (Ready in log) 437ms 437ms ▁▂▂▂▁
Cold (First Request) 1.253s 1.237s ▄▅▄▃▄
Warm (Listen) 457ms 457ms ▁▁▁▁▁
Warm (Ready in log) 441ms 442ms ▁▁▁▂▁
Warm (First Request) 342ms 341ms ▂▂▁▃▁
📦 Dev Server (Webpack) (Legacy)

📦 Dev Server (Webpack)

Metric Canary PR Change Trend
Cold (Listen) 457ms 456ms ▁▁▁▁█
Cold (Ready in log) 441ms 441ms ▃▂▃▂▅
Cold (First Request) 1.921s 1.976s ▂▃▂▃█
Warm (Listen) 457ms 456ms ▁▁▁▁█
Warm (Ready in log) 441ms 441ms ▅▄▄▄█
Warm (First Request) 1.949s 1.981s ▂▂▂▃▇

⚡ Production Builds

Metric Canary PR Change Trend
Fresh Build 3.933s 3.943s ▁▁▁▄▁
Cached Build 4.048s 4.006s ▁▁▁▄▁
📦 Production Builds (Webpack) (Legacy)

📦 Production Builds (Webpack)

Metric Canary PR Change Trend
Fresh Build 13.950s 14.264s ▁▂▁▁▇
Cached Build 14.062s 14.335s ▁▂▁▂▇
node_modules Size 472 MB 472 MB 🔴 +313 kB (+0%) ▁████
📦 Bundle Sizes

Bundle Sizes

⚡ Turbopack

Client

Main Bundles: **397 kB** → **397 kB** ⚠️ +13 B

80 files with content-based hashes (individual files not comparable between builds)

Server

Middleware
Canary PR Change
middleware-b..fest.js gzip 757 B 763 B
Total 757 B 763 B ⚠️ +6 B
Build Details
Build Manifests
Canary PR Change
_buildManifest.js gzip 452 B 449 B
Total 452 B 449 B ✅ -3 B

📦 Webpack

Client

Main Bundles
Canary PR Change
5528-HASH.js gzip 5.47 kB N/A -
6280-HASH.js gzip 57.1 kB N/A -
6335.HASH.js gzip 169 B N/A -
912-HASH.js gzip 4.53 kB N/A -
e8aec2e4-HASH.js gzip 62.6 kB N/A -
framework-HASH.js gzip 59.7 kB 59.7 kB
main-app-HASH.js gzip 255 B 251 B 🟢 4 B (-2%)
main-HASH.js gzip 39.1 kB 38.7 kB 🟢 440 B (-1%)
webpack-HASH.js gzip 1.68 kB 1.68 kB
262-HASH.js gzip N/A 4.52 kB -
2889.HASH.js gzip N/A 163 B -
5602-HASH.js gzip N/A 5.47 kB -
6948ada0-HASH.js gzip N/A 62.6 kB -
9544-HASH.js gzip N/A 54.7 kB -
Total 231 kB 228 kB ✅ -2.81 kB
Polyfills
Canary PR Change
polyfills-HASH.js gzip 39.4 kB 39.4 kB
Total 39.4 kB 39.4 kB
Pages
Canary PR Change
_app-HASH.js gzip 194 B 191 B 🟢 3 B (-2%)
_error-HASH.js gzip 183 B 177 B 🟢 6 B (-3%)
css-HASH.js gzip 331 B 330 B
dynamic-HASH.js gzip 1.81 kB 1.8 kB
edge-ssr-HASH.js gzip 256 B 254 B
head-HASH.js gzip 351 B 351 B
hooks-HASH.js gzip 384 B 382 B
image-HASH.js gzip 580 B 578 B
index-HASH.js gzip 260 B 258 B
link-HASH.js gzip 2.5 kB 2.49 kB
routerDirect..HASH.js gzip 320 B 318 B
script-HASH.js gzip 386 B 385 B
withRouter-HASH.js gzip 315 B 314 B
1afbb74e6ecf..834.css gzip 106 B 106 B
Total 7.97 kB 7.93 kB ✅ -36 B

Server

Edge SSR
Canary PR Change
edge-ssr.js gzip 126 kB 125 kB
page.js gzip 249 kB 244 kB 🟢 5 kB (-2%)
Total 374 kB 369 kB ✅ -5.78 kB
Middleware
Canary PR Change
middleware-b..fest.js gzip 616 B 615 B
middleware-r..fest.js gzip 156 B 156 B
middleware.js gzip 43.6 kB 43.5 kB
edge-runtime..pack.js gzip 842 B 842 B
Total 45.2 kB 45.1 kB ✅ -126 B
Build Details
Build Manifests
Canary PR Change
_buildManifest.js gzip 715 B 716 B
Total 715 B 716 B ⚠️ +1 B
Build Cache
Canary PR Change
0.pack gzip 3.87 MB 3.85 MB 🟢 19.4 kB (-1%)
index.pack gzip 103 kB 103 kB
index.pack.old gzip 102 kB 103 kB
Total 4.07 MB 4.05 MB ✅ -19.6 kB

🔄 Shared (bundler-independent)

Runtimes
Canary PR Change
app-page-exp...dev.js gzip 316 kB 316 kB
app-page-exp..prod.js gzip 167 kB 167 kB
app-page-tur...dev.js gzip 315 kB 315 kB
app-page-tur..prod.js gzip 167 kB 167 kB
app-page-tur...dev.js gzip 312 kB 312 kB
app-page-tur..prod.js gzip 165 kB 165 kB
app-page.run...dev.js gzip 312 kB 312 kB
app-page.run..prod.js gzip 165 kB 165 kB
app-route-ex...dev.js gzip 70.5 kB 70.5 kB
app-route-ex..prod.js gzip 49 kB 49 kB
app-route-tu...dev.js gzip 70.5 kB 70.5 kB
app-route-tu..prod.js gzip 49 kB 49 kB
app-route-tu...dev.js gzip 70.1 kB 70.1 kB
app-route-tu..prod.js gzip 48.8 kB 48.8 kB
app-route.ru...dev.js gzip 70.1 kB 70.1 kB
app-route.ru..prod.js gzip 48.7 kB 48.7 kB
dist_client_...dev.js gzip 324 B 324 B
dist_client_...dev.js gzip 326 B 326 B
dist_client_...dev.js gzip 318 B 318 B
dist_client_...dev.js gzip 317 B 317 B
pages-api-tu...dev.js gzip 43.2 kB 43.2 kB
pages-api-tu..prod.js gzip 32.9 kB 32.9 kB
pages-api.ru...dev.js gzip 43.2 kB 43.2 kB
pages-api.ru..prod.js gzip 32.8 kB 32.8 kB
pages-turbo....dev.js gzip 52.5 kB 52.5 kB
pages-turbo...prod.js gzip 38.4 kB 38.4 kB
pages.runtim...dev.js gzip 52.5 kB 52.5 kB
pages.runtim..prod.js gzip 38.4 kB 38.4 kB
server.runti..prod.js gzip 63.5 kB 63.5 kB
Total 2.8 MB 2.8 MB ⚠️ +21 B
📝 Changed Files (4 files)

Files with changes:

  • app-page-exp..ntime.dev.js
  • app-page-tur..ntime.dev.js
  • app-page-tur..ntime.dev.js
  • app-page.runtime.dev.js
View diffs
app-page-exp..ntime.dev.js

Diff too large to display

app-page-tur..ntime.dev.js

Diff too large to display

app-page-tur..ntime.dev.js

Diff too large to display

app-page.runtime.dev.js

Diff too large to display

@Netail
Copy link
Contributor

Netail commented Feb 6, 2026

Will also fix #72846 (hopefully), in favour of: #70087.
As an actually fix was done in Webpack 5.100.2.

I also tried to make an attempt: #81685 (in case you need inspiration)

@lukesandberg lukesandberg force-pushed the bump_webpack_version branch 2 times, most recently from 342ce8b to 929239e Compare February 9, 2026 20:37
@nextjs-bot nextjs-bot added Documentation Related to Next.js' official documentation. tests labels Feb 9, 2026
…ents

During HMR, the dev server sends BUILT (triggering async module.hot.apply())
before SERVER_COMPONENT_CHANGES (triggering hmrRefresh()). Previously,
hmrRefresh() fired immediately without waiting for the webpack update to
finish, creating a race where __webpack_require__ could be called for modules
that were temporarily absent from __webpack_modules__ during the swap.

This was previously masked because the resulting TypeError was caught by
React's error boundary, but webpack 5.104+ added an explicit module existence
check that turns this into a hard "Cannot find module" error.

Fix by awaiting the pendingHotUpdateWebpack promise before calling
hmrRefresh(), ensuring all webpack modules are fully in place before the RSC
response tries to reference them.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

created-by: Turbopack team PRs by the Turbopack team. Documentation Related to Next.js' official documentation. tests type: next

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Object.defineProperty called on non-object error with pdfjs-dist in webpack mode (possibly related to webpack/webpack#20095)

3 participants