- 13 Feb, 2026 31 commits
-
-
nextjs-bot authored
-
Benjamin Woodruff authored
We don't need/want preview builds for these base branches, it's a waste of CI capacity. Relevant docs: https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-syntax#onpushbranchestagsbranches-ignoretags-ignore > Use the branches filter when you want to include branch name patterns or when you want to both include and exclude branch names patterns. Use the branches-ignore filter when you only want to exclude branch name patterns. You cannot use both the branches and branches-ignore filters for the same event in a workflow. > If you define only tags/tags-ignore or only branches/branches-ignore, the workflow won't run for events affecting the undefined Git ref. If you define neither tags/tags-ignore or branches/branches-ignore, the workflow will run for events affecting either branches or tags.
-
nextjs-bot authored
-
Hendrik Liebau authored
Follow-up for #89834. In `prerenderAndAbortInSequentialTasks`, React's `finishHalt` (scheduled via `setImmediate` from `abort()`) could race with the component's pending `setTimeout` callback. When both ended up in the same timer phase, the component timer would fire after `abort()` but before `finishHalt`, linking the async graph and producing the more precise `await` location (21:9). When `finishHalt` won the race, it read an unlinked graph and fell back to the function declaration (20:16). Adding `DANGEROUSLY_runPendingImmediatesAfterCurrentTask()` to the abort task captures `finishHalt` as a fast immediate, ensuring it runs right after `abort()` before any other timers. This makes the result deterministic at the cost of always producing the less precise stack frame (function declaration instead of `await` expression). The resolve step is split into a separate task because it needs to wait for the abort's fast immediates to complete. When using `--debug-prerender`, we're also re-adding the hint to run `next dev` for even better stack traces, since dev mode can produce the precise `await` location by running the render to completion and resolving the I/O promises. [Flakiness metric](https://app.datadoghq.com/ci/test/runs?query=test_level%3Atest%20%40git.repository.id%3A%22github.com%2Fvercel%2Fnext.js%22%20%40test.type%3A%22nextjs%22%20%40test.status%3A%22fail%22%20%40test.suite%3A%22Cache%20Components%20Errors%22%20%40git.branch%3Acanary%20-%40ci.pipeline.name%3Atest-e2e-deploy-release&agg_m=count&agg_m_source=base&agg_t=count¤tTab=overview&eventStack=&fromUser=false&index=citest&start=1770404554855&end=1771009354855&paused=false)
-
JJ Kasper authored
## Summary - pass `IncrementalCache` into the shared middleware template adapter so middleware/proxy modules initialize `globalThis.__incrementalCache` - add regression coverage for `unstable_cache` usage inside both deprecated `middleware` (edge) and `proxy` (node) fixtures - verify both e2e suites pass without hitting `Invariant: incrementalCache missing in unstable_cache` ## Verification - `pnpm build` - `NEXT_SKIP_ISOLATE=1 NEXT_TEST_MODE=dev pnpm testonly test/e2e/app-dir/app-middleware/app-middleware.test.ts` - `NEXT_SKIP_ISOLATE=1 NEXT_TEST_MODE=dev pnpm testonly test/e2e/app-dir/app-middleware-proxy/app-middleware-proxy.test.ts`
-
JJ Kasper authored
## Summary - update `installCompressedModuleFactories` to reuse an existing factory in a compressed ID group when filling missing IDs - keep `newModuleId` notifications aligned with actual IDs installed (`newModuleId(id)`) - add an execution regression test for the mixed-group case where one ID already has a factory and another is missing - regenerate affected runtime snapshots (runtime/debug-ids/workers/preset_env) Aims to fix cases like this being seen recently: ```sh Error: Module 8896 was instantiated because it was required from module 18500, but the module factory is not available. ``` ``` ## Test Plan - `cargo test -p turbopack-tests --test execution test_tests__execution__turbopack__runtime__factory_group_existing_factory__input__index_js -- --nocapture` - `cargo test -p turbopack-tests --test snapshot test_tests__snapshot__runtime__default_build_runtime__input__index_js -- --nocapture` - `cargo test -p turbopack-tests --test snapshot test_tests__snapshot__runtime__default_dev_runtime__input__index_js -- --nocapture` - `cargo test -p turbopack-tests --test snapshot test_tests__snapshot__debug_ids -- --nocapture` - `cargo test -p turbopack-tests --test snapshot test_tests__snapshot__swc_transforms__preset_env__input__index_js -- --nocapture` - `cargo test -p turbopack-tests --test snapshot test_tests__snapshot__workers__ -- --nocapture`
-
Benjamin Woodruff authored
If we don't explicitly return a `Vc::cell(())` here, then `<() as dyn turbo_tasks::vc::default::ValueDefault>::value_default` gets called in a non-deterministic way. That's not something we care about testing here, so just add a an explicit `Vc::cell(())` call to avoid it.
-
Josh Story authored
Stacked on #89970 The staged rendering class will be used for more soon in more contexts (prod prerendering for runtime prefetches for example). This changes the interface for render abandonment to not use the presence of the render abort signal
-
Luke Sandberg authored
Tiny optimization, there is no need to use global names for this usecase and we can save a bit of memory and time.
-
Josh Story authored
finding the file with sync IO utils is tricky because it is called `utils`. this change gives the file a more clear name.
-
nextjs-bot authored
-
Benjamin Woodruff authored
_I wrote this PR by hand, because I wanted to make sure I got all the details right._ The previous approach for computing global names was `module path` + `item name`. Since @lukesandberg added support for inventory, we can now nest `turbo_task::function` and `turbo_task::value` macros inside any arbitrary scope:  This is a fantastic feature, but it does mean that our global names are no longer unique. @mmastrac suggested using `std::any::type_name` with a dummy marker type to get a full path. This PR attempts to do that.
-
JJ Kasper authored
These were being filtered unexpectedly causing build failures with the deferredEntries flag. x-ref: [slack thread](https://vercel.slack.com/archives/C09125LC4AX/p1771010370849309?thread_ts=1770975846.539109&cid=C09125LC4AX)
-
Tobias Koppers authored
## What? Adds support for inline loader configuration in Turbopack via import attributes. Developers can apply webpack-compatible loaders to individual imports using the `with` clause, without needing global `turbopack.rules` configuration. ```tsx import rawText from '../data.txt' with { turbopackLoader: 'raw-loader', turbopackAs: '*.js' } import value from '../data.js' with { turbopackLoader: 'string-replace-loader', turbopackLoaderOptions: '{"search":"PLACEHOLDER","replace":"replaced value"}' } ``` ## Why? Global `turbopack.rules` applies loaders to all files matching a pattern. This PR provides per-import granularity — useful when only a specific import needs special treatment, avoiding side effects on other imports of the same file type. ## How? ### Import attributes parsing (`turbopack-ecmascript/src/analyzer/imports.rs`) - Extended `ImportAnnotations` to parse four new attributes: `turbopackLoader`, `turbopackLoaderOptions`, `turbopackAs`, `turbopackModuleType` - All values are strings per TC39 import attributes spec (`turbopackLoaderOptions` is a JSON-encoded string) - Added unit tests for the parser ### New structured loader type (`turbopack-core/src/loader.rs`) - Added `WebpackLoaderItem` struct shared between inline and global loader paths ### Reference type plumbing (`turbopack-core/src/reference_type.rs`, `turbopack-ecmascript/src/references/esm/base.rs`) - Added `ImportWithTurbopackUse` variant to `EcmaScriptModulesReferenceSubType` carrying the parsed loader, rename_as, and module_type - ESM reference resolution maps the parsed annotations to this new subtype ### Loader execution (`turbopack/src/lib.rs`) - In `process_default_internal`, detects `ImportWithTurbopackUse` references and applies the loader as a source transform via the existing webpack loader infrastructure - Requires `enable_webpack_loaders` to be configured (same as global rules) - Supports `turbopackAs` (re-processes with new extension) and `turbopackModuleType` (directly sets module type) - Avoids infinite recursion by switching to plain `Import` reference type on re-processing ### Documentation (`docs/.../turbopack.mdx`) - Added section documenting the four import attributes with examples - Added version history entry for v16.2.0 ### Testing (`test/development/app-dir/turbopack-import-assertions-use/`) - E2e test covering raw loader, replace loader with options, `turbopackModuleType: 'ecmascript'`, and `turbopackModuleType: 'json'` - Turbopack-only (skipped for webpack) -
nextjs-bot authored
-
Niklas Mischkulnig authored
This caused two requests and the preloading to not be effective at all https://github.com/vercel/next.js/pull/89771 added the dpl id in CSS for `url()`s
-
Luke Sandberg authored
## Enable Rust backtraces in CI tests ### What? Added `RUST_BACKTRACE=1` environment variable to all Turbopack-related test workflows. ### Why? This change enables detailed Rust backtraces when Turbopack encounters errors during CI tests, making it easier to diagnose and fix issues that occur in the Rust components. Notably, some assertions/panics are about detecting race conditions, e.g. ``` thread 'tokio-runtime-worker' (1056161) panicked at turbopack/crates/turbo-tasks-backend/src/backend/operation/mod.rs:426:13: Concurrent task lock acquisition detected. This is not allowed and indicates a bug. It can lead to deadlocks. note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace ``` Rather than painfully attempting to reproduce locally we can just run with the env var all the time and perhaps that will be enough to figure out rare issues
-
Hendrik Liebau authored
When running `next build --debug-prerender`, React owner stacks are now captured and displayed in prerender error output. This makes it much easier to diagnose which component triggered uncached I/O or accessed request data without Suspense. Previously, `--debug-prerender` only enabled source maps and disabled minification. Now it also auto-enables `allowDevelopmentBuild` and sets `NODE_ENV=development`, which loads React development builds where `captureOwnerStack()` is available. The main challenge is that with `NODE_ENV=development`, both server and client bundles include dev-only code paths (HMR, WebSocket connections, dev overlay, debug channel, etc.) that expect a running dev server. We don't want these when using `next start`. To solve this, we introduce `process.env.__NEXT_DEV_SERVER`, an internal env var that is truthy only during `next dev`. In client bundles, it's inlined at build time (`'1'` for `next dev`, `''` for `next build`). In production server runtime bundles, it's inlined as `''` for dead-code elimination. In development server runtime bundles, it's left as a runtime check because those bundles are shared between `next dev` (where it's set) and `next build --debug-prerender` (where it's not). Meanwhile, `NODE_ENV` continues to control React's dev/prod mode and error formatting, which is exactly what we want for `--debug-prerender`. This also replaces the previous `renderOpts.dev` / `workStore.dev` pattern, which was unreliable because `RouteModule.isDev` was derived from `NODE_ENV` at compile time. When `allowDevelopmentBuild` set `NODE_ENV=development`, `isDev` would be compiled as `true` and incorrectly activate all dev guards during `next start`. Key changes: - `config.ts` auto-enables `allowDevelopmentBuild` and sets `NODE_ENV=development` when `--debug-prerender` is active - `define-env.ts` inlines `__NEXT_DEV_SERVER` into all bundles (truthy for dev, falsy for build) so dev-server features are dead-code eliminated in production and `--debug-prerender` builds - `next-dev.ts` and `next.ts` set `__NEXT_DEV_SERVER` in the process environment for externalized server-side code - `renderOpts.dev` and `workStore.dev` are removed — all consumers now use `__NEXT_DEV_SERVER` (for dev-server features) or `NODE_ENV` (for error formatting that should work in both dev and `--debug-prerender` builds) - `patch-error-inspect.ts` devirtualizes React server URLs in source map URLs so they display as readable file paths
-
Joseph authored
-
Tobias Koppers authored
## What? Moves the `turbopackIgnoreIssue` config from `experimental` to the stable `turbopack` config as `turbopack.ignoreIssue`. ## Why? Reviewers on #89682 agreed the API is stable enough to graduate from experimental. Also addresses a docs wording suggestion. ## How? - **TypeScript types**: Moved `ignoreIssue` field from `ExperimentalConfig` to `TurbopackOptions` in `config-shared.ts` - **Zod schema**: Moved validation from `experimentalSchema` to `zTurbopackConfig` in `config-schema.ts` - **Serialization**: Moved RegExp serialization logic into the turbopack block in `build/swc/index.ts` - **Rust**: Moved `ignore_issue` field from `ExperimentalConfig` to `TurbopackConfig` in `next_config.rs`, updated the `turbopack_ignore_issue_rules()` method to read from `self.turbopack` - **Tests**: Updated config in test to use `turbopack.ignoreIssue` instead of `experimental.turbopackIgnoreIssue` - **Docs**: Removed `version: experimental`, updated all code examples, moved entry from experimental table to stable config list in turbopack.mdx, fixed "Good to know" wording to say "prefer using more specific `path` patterns" (since `path` is already required)
-
Luke Sandberg authored
## What? Fixes a crash in Turbopack and incorrect behavior in Webpack when users have multiple icon files with the same base name but different extensions (e.g., `icon.png` and `icon.svg`) in their app directory. ## Why? This is a valid use case for browser fallback support - modern browsers can use SVG icons while older browsers (Safari <26) need to fall back to PNG. Previously: - **Turbopack**: Crashed during `next build` with "Dependency tracking is disabled so invalidation is not allowed" - **Webpack**: Silently ignored all but one format ## How? **Turbopack**: Changed virtual source filename from `{stem}--route-entry.js` to `{filename}--route-entry.js` (e.g., `icon.png--route-entry.js` and `icon.svg--route-entry.js`) to avoid file conflicts that triggered invalidation. **Webpack**: Changed `MetadataResolver` to return all matching files instead of just the first one. Both icon formats are now properly rendered: ```html <link rel="icon" type="image/png" sizes="114x114" href="/icon.png"> <link rel="icon" type="image/svg+xml" sizes="any" href="/icon.svg"> ``` Fixes #85496 Fixes NEXT-4816 -
Jinsoo Lee authored
## Summary - Add note that omitting `expire` in `cacheLife` results in cache never expiring - Fix `default` preset table: `expire` was documented as "1 year" but actual code uses `INFINITE_CACHE` (never) - Add mention of expire omission behavior in custom profiles section ## Why The `expire` property is optional (`expire?: number`), but the documentation didn't explain what happens when it's omitted. The source code shows it defaults to `INFINITE_CACHE` (0xfffffffe), meaning the cache never expires. Additionally, the preset profile table incorrectly listed the `default` profile's expire as "1 year" when the actual value is `INFINITE_CACHE`. ### Source code references - `packages/next/src/lib/constants.ts:45` — `INFINITE_CACHE = 0xfffffffe` - `packages/next/src/server/config-shared.ts:1580` — `default.expire: INFINITE_CACHE` - `packages/next/src/server/use-cache/cache-life.ts:156` — only sets `explicitExpire` when `expire !== undefined` - `packages/next/src/server/use-cache/use-cache-wrapper.ts:477-479` — falls back to `defaultCacheLife.expire` (INFINITE_CACHE) --------- Co-authored-by:Joseph <joseph.chamochumbi@vercel.com>
-
Niklas Mischkulnig authored
For some locations LightningCSS is 1-indexed (but not all of them, the rustdoc describes it though) IssueSource is always 0-indexed Previously, it looked like this ``` Error: Turbopack build failed with 1 errors: ./bench/basic-app/app/[variants]/styles.css:7:12 Module not found: Can't resolve './test1.png' 5 | .style { 6 | cursor: url(./test1.png); > 7 | } | ^ 8 | ``` -
Niklas Mischkulnig authored
-
Joseph authored
Closes: https://linear.app/vercel/issue/DOC-5722/inlinecss-unclear-large-bundles-description --------- Co-authored-by:
Allen Zhou <46854522+allenzhou101@users.noreply.github.com>
-
熊谷 凌 authored
-
nextjs-bot authored
-
Will Binns-Smith authored
This fixes a bug introduced in d77eb040 where installCompressedModuleFactories would skip installing factories for an entire group of module IDs if any ID in the group already had a factory registered. Test Plan: build https://github.com/vercel/workflow/tree/main/workbench/nextjs-turbopack
-
Matt Mastracci authored
## What Add a `#[derive(ValueToString)]` proc macro and convert ~45 manual `ValueToString` implementations across turbopack crates to use it (-660 lines of boilerplate, 49 files touched). ## Why Nearly every `ValueToString` impl follows the same pattern: format some fields into a string, possibly awaiting `Vc` values first. These hand-written impls are noisy boilerplate that obscure the actual format string. ## How The derive macro generates the `#[turbo_tasks::value_impl] impl ValueToString` block automatically. A helper trait `ValueToStringify` with a blanket impl for `Display` and specializations for `Vc<T>`/`ResolvedVc<T>` handles async resolution of fields. ### Supported forms - **No attribute** — delegates to `Display::to_string(&self)` - `#[value_to_string("constant")]` — emits `rcstr!` directly - `#[value_to_string("{field} text {other_field}")]` — auto-resolves named/positional fields via `ValueToStringify` - `#[value_to_string("fmt {}", expr1, expr2)]` — explicit expressions as format args - `#[value_to_string(expr)]` — single expression delegation Enums support per-variant attributes (defaulting to variant name) or a single top-level attribute. -
Joseph authored
- use experimental versioning - fix spacing for graphs - spacing in [!NOTE]
-
- 12 Feb, 2026 9 commits
-
-
nextjs-bot authored
-
Luke Sandberg authored
Add a more direct error message when next is running on a platform that turbopack doesn't support document supported turbopack platforms ## Testing To test i just set `NEXT_TEST_WASM=1` and ran a build ``` Error: Turbopack is not supported on this platform (darwin/arm64) because native bindings are not available. Only WebAssembly (WASM) bindings were loaded, and Turbopack requires native bindings. To use Next.js on this platform, use Webpack instead: next dev --webpack For more information, see: https://nextjs.org/docs/app/api-reference/turbopack#supported-platforms at ignore-listed frames ``` so it should work. Messaging probably could be better (there is also a messge about not being able to set the lockfile) but this should be much better Fixes #89305
-
nextjs-bot authored
-
nextjs-bot authored
-
Will Binns-Smith authored
This includes the set of experimental flag states in events sent to the trace upload receiver when `--experimental-trace-upload` is set. It only includes a subset of experimental flags (so things like the trace upload flag itself isn't meaninglessly sent). Since reporting is often limited to the scope of a single span, the flag state attributes are denormalized and copied onto every descendent span. Limiting the set of flags prevents this from being unnecessarily large. Test Plan: Added `test/development` test and built an app and verified these tags are sent with `NEXT_TRACE_UPLOAD_DEBUG` --------- Co-authored-by:
vercel[bot] <35613825+vercel[bot]@users.noreply.github.com> Co-authored-by:
Luke Sandberg <lukesandberg@users.noreply.github.com>
-
Andreas Lubbe authored
## Summary Fixes dev-time memory retention in `fast-set-immediate` caused by module re-evaluation chaining patched globals. ## Root Cause In dev/HMR, `fast-set-immediate.external` can be re-evaluated multiple times. On each evaluation, it captured `globalThis.setImmediate`, `globalThis.clearImmediate`, and `process.nextTick` as “originals”. If those were already patched, new patched closures referenced older patched closures, retaining old module graphs. I have 2GB local heapdump from a few minutes before the local dev server crashed OOM that looks like this because of it: <img width="632" height="253" alt="Screenshot 2026-02-10 at 18 49 24" src="https://github.com/user-attachments/assets/8162b042-ae5a-4289-9166-b11d6374a57a" /> ## What Changed - Added a process-wide sentinel of base/original timer functions on `globalThis`: - `Symbol.for('next.fast-set-immediate.originals')` - `originalSetImmediate`, `originalClearImmediate`, and `originalNextTick` now always resolve from that base sentinel, not from currently patched globals. - Kept the existing patch behavior/API surface: - `install()` still runs at module load - `DANGEROUSLY_runPendingImmediatesAfterCurrentTask`, `expectNoPendingImmediates`, and `unpatchedSetImmediate` exports remain available ## Tests `module re-evaluation` test now verifies `unpatchedSetImmediate` remains bound to the same base/original function across repeated `jest.resetModules()` reloads, and is not rebound to the previously patched global.
-
Janka Uryga authored
In dev validation, we're disassembling a payload from a dynamic render. If the request had search params, page segments in the router state will have them attached: `__PAGE__?{"q":"123"}`. In `findNavigationsToValidate`, we do the equivalent of constructing a flightRouterState, so we need to match that, otherwise we'll name the segment `__PAGE__` instead and then can't look it up in the cache, and crash during validation. -
Luke Sandberg authored
## Summary Changes `UrlBehavior.static_suffix` from `Option<RcStr>` to `ResolvedVc<Option<RcStr>>` so that `css_url_suffix` stays as a Vc longer instead of being eagerly resolved at the call site. This improves caching behavior by keeping the value cell-based through the chunking context construction. - Updated `UrlBehavior` struct definition in `turbopack-core` - Updated default fallbacks in browser/nodejs chunking contexts - Updated CSS url reference consumer to `.await?` the `ResolvedVc` - Replaced `.owned().await?` with `.to_resolved().await?` in next-core callers
-
nextjs-bot authored
-