- 24 Sep, 2026 24 commits
-
-
next-js-bot[bot] authored
-
Sebastian "Sebbie" Silbermann authored
The `test-e2e-deploy-release` run for `v16.4.0-canary.43` failed three webpack shards deterministically ([run](https://github.com/vercel/next.js/actions/runs/35989345663)) after #98847 and #98848 removed the deploy-mode exclusions. On PRs we only run deploy tests for Turbopack so these failures were missed. - `use-cache-segment-configs`: #98847 added a deploy-specific snapshot for Turbopack, but the webpack path still used the local snapshot. Vercel's fetched build logs strip code-frame indentation and trailing whitespace, so the deployed output can never match it. The webpack assertion now has its own deploy branch with the exact formatting Vercel produces. - `app-edge-invalid-reexport`: #98848 removed `skipDeployment`, but the fixture exports `preferredRegion = 'test-region'`, which the Vercel platform rejects during deployment (`Invalid region: test-region`). The test now overrides the basic page with a valid region (`iad1`) in deploy mode. The asserted re-export warnings are build-time diagnostics, so the region value does not affect them. - `deprecation-warnings`: both tests call `next.start()` inside the test body, which `e2e-utils` caps at 60 seconds when no explicit timeout is given. Deployments now take about two minutes (`Ready in 2m`, up from `Ready in 1m` in the passing canary.42 run with the same Vercel CLI 59.26.0), so both tests time out on every run. They now pass an explicit 240-second timeout, matching the other deploy tests. --------- Co-authored-by:
Claude Code (kimi-k3[1m]) <noreply@anthropic.com>
-
Jiwon Choi authored
Same-major security and latest updates received migration instructions that could send agents through unnecessary codemods and Pages Router work. Therefore split the docs and provide only the relevant context.
-
Benjamin Woodruff authored
Follow-up to #98003 so that this works with `vc deploy` (or anything else using the adapters API, this isn't a breaking change). Creates "synthetic" symlinks when it needs to rewrite a symlink target (for cross-root links). Potential follow-up: We can potentially extend the adapter API to let us pass the full symlink information to adapters that support it, so that we don't have to create a bunch of synthetic symlink files on disk.
-
Jiwon Choi authored
sonnet reaches context max right after handoff, will follow up reducing the context for same major
-
Joseph authored
Derived from the conversation over at: https://github.com/vercel/next.js/discussions/99025 I think `preload` needs that additional caveat. Document the declaration of a font-family. Note that the pattern discussed on that thread is not something we should document, at least I don't think so, I am just expanding the docs on this area.
-
next-js-bot[bot] authored
-
Tobias Koppers authored
### What? Stops Turbopack from re-chunking every App Router layout segment once per page in production builds. The manually constructed server-utilities chunk group is now only created in development. ### Why? A production build should chunk each shared layout segment exactly once. Instead, a layout segment was chunked again for every endpoint below it. On a small app with four endpoints, the root layout was chunked 4 times and a nested `dashboard` layout 2 times. The emitted output was still shared, so this was wasted build work rather than bigger bundles, which is why output-based tests never caught it. Production already builds a single module graph for the whole app, so the module graph is not what differs between endpoints. The difference comes from the server-utilities chunk group that seeds the layout-segment chain: - It is a `SharedMerged` group whose parent is the current endpoint's entry chunk group. - A merged group's parent is part of its identity, so every endpoint gets a different group (5 chunkings on the same app). - Its result seeds the availability info passed to each layout segment after it. Availability info is part of the chunking task key, so each shared segment ended up with a different key per endpoint and was chunked again. The code comment already said this manual shared chunk exists mainly to help development. That makes sense there: each endpoint has its own module graph in development, and without the group layout segments would share very little across pages. This is PR 0 of the chunk-group stack. The PRs above it are: 1. #98733 — canonical chunk-group identity 2. #98734 — graph-derived output groups 3. #98823 — Pages Router dev client graph chaining 4. #98685 — chunk-group availability bitmaps 5. #99050 — keyed chunk-group index lookups ### How? The manual server-utilities group is now created only in per-page-module-graph mode, which is development. In production the layout-segment chain starts from an endpoint-independent state, so sibling endpoints produce the same chunking task key for a shared segment. The server utilities are then chunked with the entry through the whole-app graph. Development behaves exactly as before. On the same four-endpoint app, a production build now chunks the root layout and the nested layout **once each**, and the manual server-utilities group is gone. Development still creates the group and chunks segments per page, which is expected for on-demand compilation. Adds `test/e2e/app-dir/layout-segment-chunk-sharing`, a root layout and a nested layout that share one module across two sibling pages. It asserts two things: - **Output sharing (Turbopack dev and production):** the shared module is emitted into exactly one server chunk. Webpack builds a self-contained server bundle per route, so this assertion is gated on the bundler, not the mode. - **Work sharing (Turbopack production only):** output sharing alone does not prove the chunking *task* was reused, since a segment could be re-chunked per page with an identical result. The test builds with tracing enabled and uses `next internal query-trace` to count executions of the nested layout's chunking task, which must be exactly one. A cache hit produces no execution span, so the count equals the number of real executions. Development compiles pages on demand with a module graph per page, so repeated chunking is expected there and the assertion is skipped. With the fix reverted, the work-sharing assertion fails with 2 executions, while the output-sharing assertion still passes. ### Performance Measured on a synthetic App Router app: a root layout and a nested `section/layout.tsx`, each importing M modules (~20% `'use client'`), with N trivial sibling pages under `section/`. Cold `next build` with release native builds of both commits (`192fcaf7` vs this PR, one shared JS build); paired runs in ABBA order on an 8 vCPU / 16 GB Vercel Sandbox VM; 95% Student-t intervals on the paired differences. At **800 pages × 1,000 modules per layout**, a dedicated 12-pair run: | metric | Δ | 95% CI | pairs improved | |---|---|---|---| | Turbopack compile time | **−6.3%** (−767 ms) | [−968, −565] ms | 12/12 | | total `next build` time | **−2.2%** (−764 ms) | [−1241, −287] ms | 9/12 | | Turbopack process peak RSS | **−4.2%** (−104 MB) | [−141, −68] MB | 12/12 | In traces of that build, the nested layout goes from 800 chunking executions to 1, the root layout from 802 to 1, and the server-utilities group from 803 to 0 (Node.js chunking spans overall: 7,223 → 1,617). Smaller configurations (50–800 pages × 200 modules, 200 pages × 1,000 modules; 8 pairs each) showed no detected difference in time or Turbopack memory, so the gain matters mainly for large apps. **Trade-off:** without the manual shared group, a few server utilities (the `*-async-storage.external` and `runtime-reacts.external` wrappers, the vendored `react-rsc` getter and a small `bytes` helper) are now inlined into each page's SSR entry chunk instead of being emitted once. That adds about **2.3 KB of server output per App Router endpoint** (+0.9% to +4.4% of server JS in these fixtures). Client JS is byte-identical. Keeping these modules shared in production without per-endpoint identity would be a possible follow-up. ### Verification - Trace measurement on the fixture (production): root layout 4 → 1, nested layout 2 → 1, server-utilities group 5 → 0; dev unchanged - Production build renders and serves every route with the shared module; the shared module is still emitted into exactly one server chunk - `layout-segment-chunk-sharing` — Turbopack production (3 passed), Turbopack dev (output assertion passed, trace assertion skipped), webpack production (Turbopack-only assertions skipped) - `cargo clippy --workspace --all-targets -- -D warnings -A deprecated`, `cargo fmt --all -- --check` - `turbopack-core` + `next-core` unit tests (252 passed); `turbopack-tests` snapshots (126 passed, no changes) <!-- NEXT_JS_LLM --> <!-- fleet 4f67c6f7-bbe2-454b-9a17-822a60ef8f7e --> Co-authored-by:
vercel-fleet-prod[bot] <318278635+vercel-fleet-prod[bot]@users.noreply.github.com> Co-authored-by:
Tobias Koppers <1365881+sokra@users.noreply.github.com>
-
Will Binns-Smith authored
## Summary Exclude traced project files from emitted output-type classification in the bundle analyzer. Traced TypeScript sources are synthetic provenance entries, but were classified as assets because their filenames do not use an emitted JavaScript extension. This could make JavaScript sources appear red in the treemap even when their emitted chunks are JavaScript. ## Verification - `pnpm --filter=@next/bundle-analyzer-ui build` <!-- NEXT_JS_LLM -->
-
Luke Sandberg authored
Fix AggregationGraph updates during GC. During GC we aremoving a lot of edges so this can trigger a lot of aggregation graph churn. Because of the highly parallel nature of GC this can end up with multiple queues fighting over updates which can exceed various retry limits and lead to things like trying to turn nodes into `followers` that are actively being deleted. Instead we just don't rebalance the aggregation graph during GC, instead we buffer every `rebalance` request and set the `optimize` budget to zero. Then after GC settles we process all the rebalances at once, taking care to filter out any tasks that have been since deleted. Because GC is only removing edges it can lead to inefficient graphs (too many interior nodes) but not violate graph invariants. Alternatives considered: The initial idea was to ensure GC had finished with all 'children' of the node before processing rebalance requests, but this was only a partial solution (and complex!), since it didn't handle the case of an aggregating node having multiple children become collectible in the initial scan, this could still trigger 'optimization contention' and turning dead nodes into followers. Testing: The test/benchmark are enhanced to produce non-trivial aggregation graphs which improves test coverage (though the issue of racing deletes was trivially found by CI also) --------- Co-authored-by:Claude Opus 5 (1M context) <noreply@anthropic.com>
-
Jiwon Choi authored
The ESLint migration currently changes lint configuration and dependencies even when no package script uses `next lint`. Projects using another linter or ESLint directly should keep their existing setup. Also, pin to v9 at max because plugins used by `eslint-config-next` depended on v9
-
Niklas Mischkulnig authored
These were only ever `StyledString::Text` anyway. So just store the RcStr directly Simplify the code to fix these lint errors ``` ➜ next.js-other git:(canary) ✗ pnpm sg scan error[no-map-async-cell]: Using `.map(async |...| { ...cell() })` causes non-deterministic cell order ┌─ turbopack/crates/turbopack-core/src/module_graph/mod.rs:766:33 │ 722 │ ╭ modules 723 │ │ .iter() 724 │ │ .map(async |m| { │ │ ╭──────────────────────' · │ │ 766 │ │ │ Vc::cell(rcstr!("Module graph is missing an entry point")), │ │ │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ · │ │ 798 │ │ │ }) │ ╰─│──────────────────' │ ╰─────────────────' │ = You probably want to first try_join() the async computations before wrapping them in a cell. error[no-map-async-cell]: Using `.map(async |...| { ...cell() })` causes non-deterministic cell order ┌─ turbopack/crates/turbopack-core/src/module_graph/mod.rs:767:33 │ 722 │ ╭ modules 723 │ │ .iter() 724 │ │ .map(async |m| { │ │ ╭──────────────────────' · │ │ 767 │ ╭ │ │ StyledString::Text(rcstr!( · │ │ │ 771 │ │ │ │ .cell(), │ ╰─│─│───────────────────────────────────────^ · │ │ 798 │ │ │ }) │ ╰─│──────────────────' │ ╰─────────────────' │ = You probably want to first try_join() the async computations before wrapping them in a cell. Error: 2 error(s) found in code. Help: Scan succeeded and found error level diagnostics in the codebase. ➜ next.js-other git:(canary) ✗ ``` -
Tobias Koppers authored
### What? Generate **both RSC client-reference proxies and WebAssembly loaders** under their graph-backed wrapper module identities, using one shared, higher-level content helper. Remove both generated-path exceptions from `BindingUsageInfo::used_exports` and the earlier proxy-specific export filter. ### Why? The wrapper is the module in Turbopack's graph, but its chunk item previously delegated code generation to a separately processed virtual JS module. Export-usage lookup for that proxy/loader missed the graph and fell back to “all exports used.” In a `sideEffects: false` barrel this could register a pruned client export and request a missing `<locals>` module ID. The WebAssembly loader had the same graph-identity mismatch, hidden by a separate filename-based fallback. Canary's #99102 now guards against the client-reference missing-ID symptom by checking pruned references. This PR fixes the upstream identity mismatch instead so `expand_exports()` sees real usage; #99102's independent safety checks remain in place. ### How? `chunk_item_content_with_code_from(graph_module, code_source, ...)` takes the generated source's analyzed program, references, exports, source map and async behavior while using the wrapper for the *whole code-generation module context*. Both client-reference and WASM wrappers call it. This replaces the public low-level `with_module_context` setter; it does not change module IDs, WASM output assets, React Flight registration, or the existing single-chunk WASM rejection. sokra's `ResolvedVc` suggestions are also applied. #99090's pruned-reexport-source guard remains necessary: removing it independently still fails its execution fixture. #99082 proposed reverting all of #98617 and closed unmerged; it was not a separate fix to delete. The neutral production proxy regression and two supplemental pruned-source execution fixtures remain in the PR. ### Verification - **WASM can-fail/can-pass:** all 3 existing WASM execution fixtures pass before removing the fallback; with the fallback removed but old loader delegation retained, all 3 fail `export usage not found ...wasm_.loader.mjs`; with the shared helper, all 3 pass (instantiation, imported functions/memory, and `?module` compilation). - **Proxy can-fail/can-pass:** without the wrapper-context path and proxy fallback, the production fixture fails `export usage not found .../__nextjs-internal-proxy.mjs`; with the fix it passes. - **Rust/build:** 1,282 tests pass across affected crates; clippy (`-D warnings`), rustfmt and `pnpm build-all` (18/18 tasks) pass. - **Next.js integration:** Turbopack production 6 suites/12 tests (proxy, used client references, #99102 regression, edge WASM and WASM output tracing); development 3 suites/8 tests (proxy, used client references and edge WASM). Client-reference chunking 1/1. After rebasing onto current canary, `pnpm build-all` and focused proxy/edge WASM production tests (3 suites/7 tests) pass again. <!-- NEXT_JS_LLM --> <!-- fleet ecdfa248-cd54-41ac-b4a2-c9d49e2a67ee --> --------- Co-authored-by:
vercel-fleet-prod[bot] <318278635+vercel-fleet-prod[bot]@users.noreply.github.com> Co-authored-by:
Tobias Koppers <1365881+sokra@users.noreply.github.com> Co-authored-by:
Luke Sandberg <210140+lukesandberg@users.noreply.github.com>
-
Janka Uryga authored
Adjusts Instant Validation internals to validate the `ShellStatic` stage instead of `ShellRuntime` when `ensureStatic >= "shell"`. If that's the case, the client will do a static request (and extract the shell from it), so the app shell cannot access session data (unlike the PPF default, where we use a runtime shell). Note that in some cases, this might seem more restrictive than needed. For `ensureStatic >= "shell"`, the client will do a static prefetch that goes up to the `Static` stage which resolves more things, like static `params`, `prefetch()` ( in the `PrefetchStatic` stage) and `navigation()` (in the `NavigationStatic` stage). However: 1. The client expects to be able to rewind the static prefetch into a shell and reuse it across the whole route, so we should be validating that the shell is actually useful. 2. For `ensureStatic = "shell"`, we might still do a *runtime* prefetch (with `<Link prefetch={true}>`), which will not have `navigation()`, and validating `ShellStatic` catches that. ### Implementation notes - I've renamed `RequestStore.needsAppShell` to `RequestStore.needsRuntimeShell` (undoing a previous rename), because the `ShellStatic` stage can _also_ be an App Shell, just not a _runtime_ one. The flag controls whether or not we're delaying link data until the runtime stages, which we don't need to do if the shell is static. - If we have `ensureStatic >= "shell"` set, we _won't_ set `RequestStore.needsRuntimeShell` anymore, which means that the main render can once again be re-used for both IV and SSV. `prepareValidationInputsInPartialPrefetching` is changed accordingly. We'll also set `revealAfterStage` to `StaticShell` to match what the client would have prefetched. - We add a new mode in instant validation, `ValidationPrefetchKind.StaticAppShell`, which checks the prefetch at the `ShellStatic` stage. This is enabled if we have `ensureStatic >= "shell"`. the PPF default mode`ValidationPrefetchKind.RuntimeAppShell` uses `ShellRuntime` instead. ### Tests - IV should show an insight for unguarded `cookies()` if `ensureStatic >= "shell"` (unlike the default behavior of app shells) - IV should *still* show an insight for unguarded static `params`, `prefetch()`, and `navigation()` regardless of `ensureStatic` (same as default) -
Jimmy Miller authored
Test was flaking on grabbing redbox error message. In my testing grabbing the cli output instead got rid of the flakes.
-
Sebastian "Sebbie" Silbermann authored
Skips the tests that flaked during deploy in the `test-e2e-deploy-release` run for `v16.4.0-canary.41` ([run 35935267084, attempt 2](https://github.com/vercel/next.js/actions/runs/35935267084/attempts/2)), using `// @force-gate !deploy` so they keep running in dev and start CI: - `parallel-routes-and-interception`: `should support parallel route tab bars` (Webpack 2/8 and Turbopack 1/12), `should throw a 404 when no matching parallel route is found` (Turbopack 1/12), `should handle a loading state` (Webpack 2/8) - `prefetch-static-shell`: `[FAILING] speculative: attempts a static prefetch and does not fall back to a runtime prefetch` (Webpack 8/8) - `prefetch-fallback-static`: 6 cases under `when the param was not prerendered and an ISR fallback was served` (Adapter Turbopack 8/12; the 2 sibling cases that passed stay ungated)
-
Sebastian "Sebbie" Silbermann authored
A rerun or new run on the same commit currently reuploads and overwrites the tarballs. Mostly to accomodate full runs on a commit to get all the binaries (regular runs only build for Linux). Instead, we'll soon return a 409 from the server so that a tarball can be served as immutable. This PR makes the client resilient against 409s. If we ever build different variants for the same commit, we should update the route instead to reflect different build variants. This is would be the better choice anyway so that you know what build variant is behind a commit. Co-authored-by:Claude Code (kimi-k3[1m]) <noreply@anthropic.com>
-
next-js-bot[bot] authored
-
Tobias Koppers authored
### What? Tune production Node.js server JavaScript chunking to use a lower estimated cost for loading a chunk, a smaller soft minimum chunk size, and no per-group chunk-count target. Client, CSS, Edge, and development chunking remain unchanged. ### Why? Server chunks are loaded with Node.js `require()`, not network requests. Measurements across synthetic JavaScript chunks found roughly 0.1 ms of fixed load overhead, equivalent to approximately 2.5–25 KB of parsing work depending on code density. The existing 200 KB estimate overweights each server-side load and encourages unnecessary merging. ### How? Apply the server-specific tuning to both Node production chunking contexts while keeping the existing maximum merge size. The values are an initial estimate from the benchmark; representative application builds and cold-start measurements can refine them. ### Verification - `cargo fmt --manifest-path crates/next-core/Cargo.toml -- --check` — passed. - `git diff --check` and checks of both Node contexts and unchanged Edge values — passed. - `cargo check -p next-core --offline` — blocked before compilation by an uncached `bgw/bincode` Git dependency. <!-- NEXT_JS_LLM --> <!-- fleet 8b0bc78c-72fb-424d-a85e-c5a5b87ff5f4 --> Co-authored-by:
vercel-fleet-prod[bot] <318278635+vercel-fleet-prod[bot]@users.noreply.github.com> Co-authored-by:
Tobias Koppers <1365881+sokra@users.noreply.github.com>
-
Niklas Mischkulnig authored
Regression from #98617
-
Jamiboy Mohammad authored
## Summary Enable deployment coverage for six TypeScript configuration-error tests using the deferred deployment lifecycle from #98776. Assert a failed build/deployment and the specific type error instead of using local-only build APIs. Explicitly enable the native TypeScript loader in the two next.config.ts fixtures that rely on top-level await, so they reach their intended type-checking error. ## Verification - All six fixtures passed Turbopack production/development and Webpack production checks after the native-loader fixture correction. - Local checks used the published native binding. Exact native and deploy validation are pending repository CI. <!-- NEXT_JS_LLM -->
-
Jamiboy Mohammad authored
## Summary Enable deployment coverage for 11 routing and validation exclusion locations on top of #98776. Replace local-only build calls with explicit start/failure assertions while preserving each expected diagnostic and development behavior. The edge re-export test continues to accept a successful Webpack build with warnings; Turbopack must fail. ## Verification - Focused Turbopack production/development checks passed. - Webpack production checks passed after correcting the edge re-export expectation. - Local checks used the published native binding. Exact native and deploy validation are pending repository CI. <!-- NEXT_JS_LLM -->
-
Jamiboy Mohammad authored
## Summary Enable deployment coverage for 13 cache/prerender exclusion locations across 11 test files, using the deferred deployment lifecycle from #98776. Tests explicitly start the build/deployment, assert its failure, and retain the original diagnostics. Remove the corresponding deploy gates and explanatory TODOs, and allow four minutes for tests that perform a deployment in their bodies. ## Verification - Focused Turbopack production and development checks passed. Two timing-sensitive development suites passed on recheck after comparing with the unchanged base. - All applicable Webpack production checks passed; existing bundler exclusions are preserved. - Local checks used the published native binding. Exact native and deploy validation are pending repository CI. <!-- NEXT_JS_LLM -->
-
next-js-bot[bot] authored
-
- 23 Sep, 2026 16 commits
-
-
Sebastian "Sebbie" Silbermann authored
The build-and-deploy workflow can conclude successfully without producing a `preview-tarballs` artifact, for example when its `deploy-tarball` job is skipped on docs-only canary pushes or on production tag pushes (https://github.com/vercel/next.js/actions/runs/35075211933). The `upload-preview-tarballs` workflow then failed when downloading the artifact. This change lets the download step fail without failing the job and skips the upload step in that case, so a missing artifact no longer turns the workflow red. The failed-but-tolerated download step still leaves an error annotation on the green run. Real breakage still surfaces in build-and-test, which waits on the published tarballs.
-
Sebastian "Sebbie" Silbermann authored
The `upload-preview-tarballs` workflow aborted its entire run when a single tarball upload hit a transient network error, and the logged error did not identify which package or request had failed. One observed run failed with `TypeError: fetch failed` (`UND_ERR_SOCKET`) after the ~78MB `next` tarball body had been written but before the response arrived (e.g. https://github.com/vercel/next.js/actions/runs/35721116824/job/106724007428#step:4:19). `scripts/upload-preview-tarballs.js` now wraps each package's upload in a retry with exponential backoff (5 attempts, 1s/2s/4s/8s). Every failure is retried, including network-level rejections without an HTTP status. Error messages now name the package and the failed request phase, and non-OK responses include a truncated response body alongside the status and response headers such as `x-vercel-id`, so the next rare failure is actionable. A package that exhausts its retries no longer aborts the remaining uploads; all failures are collected and reported at the end as an `AggregateError`. Co-authored-by:
Claude Code (kimi-k3[1m]) <noreply@anthropic.com>
-
Will Binns-Smith authored
### What? Promote the Turbopack bundle analyzer to `next analyze` and its build-time option to `next build --analyze`. Update CLI help, docs, and analyzer UI guidance to use those names, and remove the guide's experimental label. Keep both experimental spellings available for existing scripts. ### Why? Users should be able to discover and use the concise analyzer names without breaking workflows that already rely on the experimental command or build flag. ### How? The standalone analyzer uses a Commander command alias, so both command names share one implementation and option set. The build flag uses a hidden compatibility option, with both spellings driving the same Turbopack-only build analysis path. The existing analyzer e2e tests exercise the primary command. <!-- NEXT_JS_LLM --> <!-- fleet b2dc2832-cda3-4277-8570-6782a3a67c6e --> --------- Co-authored-by:
vercel-fleet-prod[bot] <318278635+vercel-fleet-prod[bot]@users.noreply.github.com> Co-authored-by:
Will Binns-Smith <755844+wbinnssmith@users.noreply.github.com>
-
Jiwon Choi authored
### Why? Coding agents can retry startup successfully and omit the upgrade reminder from their final response. That leaves users unaware of a security, latest-version, or Future Defaults recommendation. ### How? Tell agents to include the applicable upgrade recommendation when they report back, even if the retry succeeds. Assert this wording for all three reminder paths. Local focused Jest verification could not initialize because this worktree lacks the dependency setup required by the main checkout's compiled Next.js output. <!-- NEXT_JS_LLM -->
-
next-js-bot[bot] authored
-
Tobias Koppers authored
### What? Add the experimental `customWebpack` configuration option so webpack-mode applications can use a project-installed webpack version instead of the version bundled with Next.js. Webpack is now an optional `^5.98.0` peer dependency, and the new option is documented with end-to-end coverage for webpack 5.98.0 and 5.111.0. ### Why? Next.js currently redirects webpack imports to its bundled implementation. This prevents applications from opting into newer compatible webpack releases or validating upgrades independently. The new option provides an explicit escape hatch while preserving the bundled implementation as the default. ### How? After configuration is resolved, webpack-mode startup redirects the existing webpack require-hook aliases to the package resolved from the application. The selection is propagated to webpack build workers through the existing local-webpack runtime switch. If the optional peer cannot be resolved, Next.js restores its bundled aliases and reports an actionable installation error. The implementation only activates for webpack, leaving Turbopack and Rspack unchanged. It also handles the resolver stack API exposed by external webpack versions. The test matrix verifies the selected compiler version, rendering in development and production, the build-worker path, missing-peer diagnostics, and bundled fallback behavior when the option is disabled. ### Verification - `pnpm test-dev-webpack test/e2e/app-dir/custom-webpack/custom-webpack.test.ts` - `pnpm test-start-webpack test/e2e/app-dir/custom-webpack/custom-webpack.test.ts` - `pnpm --filter=next types` <!-- NEXT_JS_LLM --> <!-- fleet 19431696-5f4c-400d-a3be-700bfe86abda --> --------- Co-authored-by:
vercel-fleet-prod[bot] <318278635+vercel-fleet-prod[bot]@users.noreply.github.com> Co-authored-by:
Tobias Koppers <1365881+sokra@users.noreply.github.com>
-
Jiwon Choi authored
### Why? The agent nudge offers a background upgrade without specifying a separate checkout, so upgrade edits can land alongside the current task’s changes. ### How? Make both the nudge and upgrade handoff instruct the agent to use a separate Git worktree unless the user explicitly requests otherwise. The handoff directs upgrade commands to the app’s corresponding directory in that worktree. Update the existing prompt assertions and snapshots to match. <!-- NEXT_JS_LLM -->
-
Jiwon Choi authored
### Why? The missing-app error tells users to pass an app path without showing where it belongs in the command. ### How? Add `next upgrade [directory] --ai=<supplied value>` to the error, preserving the supplied AI upgrade type or bare `--ai` so users can retry with an explicit directory. <!-- NEXT_JS_LLM -->
-
Hendrik Liebau authored
An on-demand prerender failure still throws when its recovery output requires a resume. This hides the route's error boundary behind a generic error response, even when healthy parts of the page could continue rendering. Failures now retain their original error and serialized postponed state. Self-hosted servers append a separate continuation for each document request. Adapter deployments use the existing platform transport to resume with the actual request. In `next start`, a failed partial prerender follows the same prerender and resume flow as a successful PPR cache miss. Failed preludes are not persisted, so later independent requests retry prerendering before resuming. Concurrent requests can share the pending prerender, and each document request owns its resume. The response retains status 500 and non-cacheable headers. Failed output is not persisted as a successful ISR entry. Build failures and recovery without a usable Flight result continue to throw. The tests cover errors inside and outside Suspense, request-specific dynamic content, navigation after failed prefetches, same-URL recovery, successful-page retention, and original-error reporting.
-
Hendrik Liebau authored
In production, an error while generating an App Router page on demand can return a generic 500 response or a Pages Router 500 page instead of the route's `error.tsx` or `global-error.tsx`. This affects dynamic routes using `generateStaticParams`, even though their error boundaries work in development. A completed prerender failure now carries its error and recovery output through the renderer and response cache as an explicit result. The response cache retains completed failures within each platform invocation, without changing existing in-flight batching. Failed output is not persisted as a successful ISR entry. The server sends recovered documents with status 500 and non-cacheable headers. Failed RSC responses have empty bodies; navigation falls back to loading the document. Build failures and incomplete recovery continue to throw. Asynchronous error reporting runs in the background and uses the platform's `waitUntil` when available. Recovery that requires resuming a partially prerendered page is out of scope for this PR and continues to throw. A follow-up PR will preserve and resume that partial recovery output. The fix applies to self-hosted production servers and adapter-based Vercel deployments. The legacy Vercel deployment path retains its existing behavior of replacing the response with a generic error page. The tests cover both Cache Components settings, batched invocation failures, pending I/O inside Suspense, same-URL recovery, successful-page retention, and original-error reporting. Fixes #62046
-
Tobias Koppers authored
## Summary Clarify the examples for `ModulePart::Export` and `ModulePart::Exports` so they illustrate the export declarations those parts represent, rather than the importing site or a single-export case. This follows two late review suggestions on the already-merged #96396: [named export](https://github.com/vercel/next.js/pull/96396#discussion_r4082789388) and [export declarations](https://github.com/vercel/next.js/pull/96396#discussion_r4082794496). No behavior changes. ## Verification - `cargo fmt --all -- --check` (from `turbopack/`) - `git diff --check` - Confirmed the diff changes only two Rust doc-comment lines. <!-- NEXT_JS_LLM --> <!-- fleet 993ef5d6-cc80-4082-8e14-ff9ac871ce33 --> Co-authored-by:
vercel-fleet-prod[bot] <318278635+vercel-fleet-prod[bot]@users.noreply.github.com> Co-authored-by:
Tobias Koppers <1365881+sokra@users.noreply.github.com> Co-authored-by:
Luke Sandberg <210140+lukesandberg@users.noreply.github.com>
-
Luke Sandberg authored
### What? next will delete some or all of the contents of `distDir` on start depending on mode. This is normally fine for the default `.next/` dir but for a user specified one it can be dangerous if it is misconfigured. Add some safety checks that the directory is in a valid location I explored enforcing that the specified directory was either empty, missing or filled only with files from a prior build/dev session, but this is very ambiguous and would add a speed bump to upgrade paths. re-compatibility: This PR is enforcing a constraint that wasn't previously enforced. In the error case we are addressing (setting dist dir to be the workspace root or appliction root), this is not considered breaking because all such uses would be catastrophic (application files deleted). The other enforcement is that the dist-dir is fully _contained_, this was always strictly enforced for turbopack but for webpack it would only fail later during dev-serving or SSG. So this is just making an obscure error more eager and consistent. Fixes #98958 --------- Co-authored-by:
Claude Opus 5 (1M context) <noreply@anthropic.com> Co-authored-by:
vercel-fleet-prod[bot] <318278635+vercel-fleet-prod[bot]@users.noreply.github.com> Co-authored-by:
Luke Sandberg <210140+lukesandberg@users.noreply.github.com> Co-authored-by:
Tobias Koppers <1365881+sokra@users.noreply.github.com>
-
Josh Story authored
## Summary Keep route admission independent of ISR cache contents. With Cache Components disabled, a route using `dynamicParams = false` and `generateStaticParams()` can currently return 200 for a build-generated URL, then incorrectly return 404 after `revalidatePath` expires its cache entry. An empty external cache causes the same failure on the first request. For example, if the build generated `/products/known`, that URL remains allowed after invalidation; `/products/unlisted` remains disallowed regardless of cache state. If a later build removes `/products/known`, it must immediately stop matching, even if an external cache still holds that URL's old response. The request handler now rejects unlisted closed URLs before looking up their ISR entries. This prevents both serving an old cache hit and generating a new response for a URL the current build does not admit. An admitted build path whose matched fallback is `false` regenerates using a blocking render when necessary. The two decisions stay separate: the manifest determines whether the URL may match, while the response generator chooses how to produce an admitted response. We do not share mutable fallback-mode state between those stages. ### Preserved exceptions and adapter behavior - **Server Actions:** forwarding can invoke a worker at `/products/[slug]`, not a concrete page URL. Action calls retain their existing exemption from page admission checks. A retained action must still work after the user navigates away from its closed route. - **Draft mode:** an unpublished URL can be previewed without admitting it publicly or replacing its public cache entry. - **Minimal mode:** the platform router remains responsible for admission before invoking the renderer. - **Adapters:** rendering a routing 404 now happens outside the response cache. The previous placement could successfully send a 404 and then throw `cache entry required but not generated` because it returned no cache entry for a non-null cache key. The new adapter fixture reproduces this on the parent runtime. This uses the existing prerender manifest and does not change its format or the adapter contract. The most specific matched dynamic route continues to determine the policy for open URLs, so specialized matchers can admit an open suffix without admitting an unknown closed prefix. ## Regression coverage Real fixtures cover: - Repeated invalidation, ordinary and optional catch-all paths, time-based ISR, concurrent regeneration, and serving a stale response while regenerating in the background. - Empty external caches and an external cache retained across two real builds. The latter verifies that the removed path's old entry still exists but is never consulted. - Document, HEAD, navigation, prefetch, bot, rewritten, and overlapping-route requests. - Direct and forwarded Server Actions, draft previews, and direct minimal-mode renderer invocations. - Adapter-specific 404 handling and regeneration of admitted paths. - The distinction between routing rejection and content that calls `notFound()`: an admitted URL can transition from 200 to 404 and back, including when its build render returned 404. These legacy `dynamicParams` fixtures are excluded from the Cache Components matrix because that configuration does not support the API. ## Stack This is an unflagged correctness fix, placed after #98950 and before the parameter-matching API in #97393. It can land without committing to that API. The API's mixed-prefix and dynamic-tail lifecycle coverage belongs in the API layer. ## Verification - Before the original fix, the two initial regression fixtures failed 11 checks while the open-route and time-based controls passed. - Against the parent runtime, the new adapter fixture reproduces the cache-entry invariant on document, navigation, prefetch, and bot requests, plus the invalidation regression. - The retained Server Action regression passes on the parent runtime, fails on the earlier PR revision without the exemption, and passes with the explicit action exemption. It also passes in development with the exemption. - Local production runs before replaying the follow-up onto the rebased stack: all 49 tests across seven suites pass in both Webpack and fresh-native Turbopack, including the existing closed-parameter navigation suite. The follow-up patch applied unchanged; CI will verify the rebased head. - Development Turbopack request-mode coverage: 10 passed; the public-cache reuse assertion is production-only. - Repository TypeScript, Next.js declaration generation, changed-file formatting/ESLint, and `git diff --check` pass. No live deployment verification. A separate `revalidate-if-generated` hang with an always-empty custom cache reproduces on both this PR and its parent; its diagnostic is retained for a separate follow-up, not included or silently skipped here. <!-- NEXT_JS_LLM -->
-
Jimmy Miller authored
So in some testing I found a rare error where a child task could take the suspend point, causing it to decrement the counter even though it hadn't incremented it. Move this operation to the guard makes this not impossible (you can still just grab the coordinator) but at least in this code path makes it unlikely you do this. It fixes the bug I found. Discussed this with Luke. We agreed trying to recreate the case in a unit test would probably be a bit overkill.
-
Aurora Scharff authored
## Summary - reduce the managed agent-feedback block from 199 to 160 words while restoring four scannable issue-category bullets - explicitly authorize the feedback pass without coupling it to `agentRules` - explain that `next dev` restores the managed block and that committing `AGENTS.md` keeps the tree clean - preserve the network-sandbox retry and tell agents to read the command output once without piping or truncating it - clarify that prepared reports remain in a browser URL fragment until the user submits them - keep the AI agents guide, API reference, focused integration coverage, and eval fixtures in sync - restore the `CLAUDE.md` compatibility import inside eval sandboxes only, without generating it for users - replace subjective feedback transcript judges with deterministic source and report-payload checks The existing `agentRules` managed block is unchanged. ## Eval results | Eval | Existing instructions | Shortened instructions | | --- | --- | --- | | Routine debugging | 10/10 passed in #98887 | Earlier runs produced no reports; a post-harness-fix rerun is pending | | Anonymization | 2/2 reporting checks passed in #98887 | The post-harness-fix rerun reached AI Gateway timeouts; deterministic schema and redaction checks are in place | | Distinct issues | 1/1 passed in #98887 | The post-harness-fix run produced two distinct valid reports; both deterministic report checks passed | The historical results come from #98887. The shortened-instruction runs use the same private `agent-feedback` treatment and are not published to nextjs.org/evals. The fixtures explicitly enable `experimental.agentFeedback`, matching the production opt-in. The previous transcript judges mixed feature behavior with subjective judgments about browser-opening attempts. The fixtures now check the actual product outcomes directly: routine work produces no report, a qualifying issue produces one valid anonymized report, and distinct issues produce separate valid reports. ## Verification - `pnpm testonly packages/next/src/server/lib/generate-agent-files.test.ts` (10/10 passed) - `NEXT_SKIP_ISOLATE=1 HEADLESS=true pnpm test-dev-turbo test/development/app-dir/agent-rules-auto-generate/agent-rules-auto-generate.test.ts` (12/12 passed) - eval fixture dry-runs for `agent-057-agent-feedback-anonymization` and `agent-058-agent-feedback-distinct-issues` - targeted Prettier and ESLint through the pre-commit hook <!-- NEXT_JS_LLM -->
-
Aurora Scharff authored
## Summary - Clarify that Cache Components uses PPR for every App Router page, including pages whose build-time HTML is empty. - Explain that the current tree-view symbols describe output rather than a different rendering model: an empty PPR HTML output can show `ƒ` at a fixed pathname or `◐` on a dynamic-path fallback row. - Clarify that Cache Components pages do not use `●`; generated paths from `generateStaticParams` show `○` or `◐` based on their HTML output. - Clarify that `instant = false` opts out of instant-navigation validation and, when it is the highest config, static-shell validation without changing the PPR rendering model. - Keep the guide's existing structure and examples while correcting factual wording about TypeScript checking, `generateStaticParams`, Partial Prefetching, cache lifetime output, and build debugging. - Remove signposting, filler, and unverified claims in the sections being corrected. ## Verification - `pnpm prettier --with-node-modules --ignore-path .prettierignore --check docs/01-app/02-guides/building.mdx` - `npx eslint --config eslint.config.mjs docs/01-app/02-guides/building.mdx` - `git diff --check` - Verified with `cacheComponents: true` that a fixed page covered by `instant = false` prints `ƒ`, writes 0-byte HTML, and remains `PARTIALLY_STATIC` in the prerender manifest. Removing the opt-out produces the expected prerender-blocking error. - Verified that a Cache Components route using `generateStaticParams` prints an unmarked route group, a `◐` fallback, and a `○` generated pathname without any `●` row. - Verified `instant = false` with synchronous runtime values and `--debug-prerender` source frames against a minimal Cache Components app using the local Next.js package and webpack. - Not run: `pnpm lint` (docs-only change; focused formatting, ESLint, and runtime checks passed). <!-- NEXT_JS_LLM -->
-