- 17 Jan, 2026 4 commits
-
-
nextjs-bot authored
-
Hendrik Liebau authored
Always escape Next.js dynamic route brackets (e.g., `[slug]`) in `--debug-build-paths` patterns instead of checking filesystem existence. The previous approach failed when glob wildcards like `**` preceded bracket expressions (e.g., `app/**/[slug]/page.tsx`) because `fs.existsSync` cannot resolve paths containing glob characters. Since users of this flag are always referring to actual Next.js routes, brackets should always be treated as literal directory names rather than glob character classes.
-
Janka Uryga authored
Follow up to #88346. Looks like the change there crashes in edge because `globalThis.setImmediate` isn't defined, so we check before accessing.
-
Sebastian "Sebbie" Silbermann authored
-
- 16 Jan, 2026 24 commits
-
-
Luke Sandberg authored
Add support for bundling worker_threads workers Previously we only supported tracing dependencies of worker threads. However, this could trigger issues if the callsite was getting bundled since we would believe that the file was both bundled and unbundled. The solution is to support bundling modules using worker threads and implementing the threads. This requires a new reference and loader module type which follows the patter of async-loaders and webworkers. An interesting consideration is about file extensions. `new Worker(...)` takes a relative or absolute filepath, in node 23+ that means you can load typescript files directly, so we support the same. If you want to load a `.ts` file you need to write `foo.ts` we don't do any pattern rewriting. This fixes a bug reported by an X user: https://x.com/strugglercss/status/2002504736860484008?s=20. The problem with the previous approach is that we would record the reference as 'traced', but if you did `new Worker(__filename,...)` then we would end up with 'traced references' to a file that was bundled. This caused issues during tracing when we tried to add CachedExternalModule references to the nft json files ``` Error [TurbopackInternalError]: NftJsonAsset: cannot handle filepath url Debug info: - Execution of get_all_written_entrypoints_with_issues_operation failed - Execution of EntrypointsOperation::new failed - Execution of all_entrypoints_write_to_disk_operation failed - Execution of Project::emit_all_output_assets failed - Execution of emit_assets failed - Execution of emit failed - Execution of <NftJsonAsset as Asset>::content failed - NftJsonAsset: cannot handle filepath url at <unknown> (TurbopackInternalError: NftJsonAsset: cannot handle filepath url) { ``` there `url` was due to a `require('url')` statement in a bundled file this caused us to produce an external shim, but a `new Worker(__filename)` caused us to also create a traced reference to the same file. The problem there was simply that the `ident()` for a `CachedExternalModule` contains a dummy filepath that broke the nft.json asset production. The root issue here is that the `FilePathModuleReference` was using the wrong `AssetContext` to construct the referenced module which lead to the wrong files being traced. After investigation @mischnic and I determined that that was an insufficient fix since we really do need to rewrite the reference. Proper bundling support fixes this directly and the pattern here paves the way for more worker support in the future. This doesn't seem like the only way a synthetic module (like an extern module) might end up as a dependency of traced module, so a more robust solution is probably in order.
-
nextjs-bot authored
-
Benjamin Woodruff authored
Follow up to https://github.com/vercel/next.js/pull/88644
-
jgeschwendt authored
### What? Capture `setImmediate[promisify.custom]` at module initialization instead of lazily accessing it when needed. ``` RangeError: Maximum call stack size exceeded at patchedSetImmediatePromise (node_modules/.pnpm/next@16.1.1_@babel+core@7.28.5_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/next/src/server/node-environment-extensions/fast-set-immediate.external.ts:626:27) at originalPromisify (node_modules/.pnpm/next@16.1.1_@babel+core@7.28.5_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/next/src/server/node-environment-extensions/fast-set-immediate.external.ts:627:12) ``` This was discovered upgrading from `16.0.10` to `16.1.0` ### Why? When `util.promisify(setImmediate)` is called and `currentExecution === null`, the code was accessing `originalSetImmediate[promisify.custom]` at call time. However, `promisify.custom` can get lost or return `undefined` after the module patches `setImmediate`, causing `promisify(setImmediate)` to fail. Specifically, when used with `jest`. Reproduction: https://github.com/jgeschwendt/nextjs-setimmediate-promisify-repro - Failing: https://github.com/jgeschwendt/nextjs-setimmediate-promisify-repro/actions/runs/20864170776 - Passing (with fix): https://github.com/jgeschwendt/nextjs-setimmediate-promisify-repro/actions/runs/20864380068 - https://github.com/jgeschwendt/nextjs-setimmediate-promisify-repro/pull/1 ### How? Move the capture of `originalSetImmediate[promisify.custom]` to module initialization time (alongside `originalSetImmediate`, `originalClearImmediate`, and `originalNextTick`), ensuring the original promisified implementation is preserved before any patching occurs. -
Will Binns-Smith authored
Update the bug report link to use the new bugs.nextjs.org service instead of the direct GitHub discussions URL. Also shares more code when handling terminals that don't support links. Test Plan: Added a deliberate panic to a turbotask, verified the link.
-
Tobias Koppers authored
### What? Part of PACK-1007 Adds `condition.query` support to Turbopack's loader rules, enabling loaders to match based on import query strings (e.g., `import './file?raw'`). This mirrors webpack's `resourceQuery` functionality. The `query` condition accepts either a string (exact match) or RegExp (pattern match). Adds tests and documentation for the new `condition.query` option. ### How to use ```js // next.config.js module.exports = { turbopack: { rules: { '*.txt': [ // String: exact match { condition: { query: '?raw' }, loaders: ['raw-loader'], as: '*.js' }, // RegExp: pattern match { condition: { query: /\?transform/ }, loaders: ['transform-loader'], as: '*.js' }, ], }, }, } ``` -
Neha Prasad authored
### What? Fixed TypeScript error where `RedirectType.replace` and `RedirectType.push` were typed as `string` instead of literal types, causing compilation errors when used with `redirect()`. ### Why? `RedirectType` constant properties weren't properly typed as literal types, causing TypeScript to see them as generic `string` values instead of the expected `'push' | 'replace'` union. ### How? - Added `as const` to `RedirectType` properties in `packages/next/src/client/components/navigation.react-server.ts`. Fixes #88627 --------- Co-authored-by:Zack Tanner <1939140+ztanner@users.noreply.github.com>
-
nextjs-bot authored
-
nextjs-bot authored
-
Tobias Koppers authored
### What? Make make_chunks a cached function to allow it to be cached even when the module graph changes (assuming that chunk group's chunk items are not affected by the change)
-
Tobias Koppers authored
### What? Use selective reads for merged modules data. This is a preparation to make chunking be less dependent on module graph changes.
-
Tobias Koppers authored
### What? Use selective reads for module chunk groups from chunk group info This is a preparation to make chunking be less dependent on module graph changes.
-
Jiachi Liu authored
-
Jiachi Liu authored
-
Tobias Koppers authored
### What? To be able to used MappedReadRefs in async context, they need to be Send.
-
Tobias Koppers authored
### What? Use selection reads for module id to avoid functions
-
Tobias Koppers authored
### What? follow spans through the aggregation update queue
-
Tobias Koppers authored
### What? Use strongly consistent reads for compute_async_module_info to avoid double execution.
-
Tobias Koppers authored
### What? Refactor ModuleGraph to be a strongly consistent snapshot of the module graph. This should avoid eventually consistency problems where different versions of single module graphs do not fit together.
-
Tobias Koppers authored
### What? Too few tasks leave no space for tokio to act.
-
Jiachi Liu authored
add link to the mcp client configuration details section before the code block of example --------- Co-authored-by:
Vercel <vercel[bot]@users.noreply.github.com> Co-authored-by:
timneutkens <tim@timneutkens.nl>
-
Tim Neutkens authored
## What Fix the incorrect "Ready in" time displayed when running `next start`. The bug caused the time to show impossibly large values like "Ready in 29474457.7min" instead of the actual startup duration. ## Why The `NEXT_PRIVATE_START_TIME` environment variable was not being properly set/propagated when `startServer()` read it. When the variable was missing, the code defaulted to `0`, causing the calculation `Date.now() - 0` to equal the entire Unix timestamp (~1.77 trillion milliseconds ≈ 29 million minutes). ## How 1. Added a fallback in `cli/next-start.ts` to set `NEXT_PRIVATE_START_TIME` if it's not already set by `bin/next.ts` 2. Updated the calculation in `start-server.ts` to use `0` as the duration if `startTime` is falsy, preventing the bug 3. Removed unused performance mark code that was leftover ## Test Plan Run `next start` on a production build and verify the "Ready in" time shows a reasonable value (e.g., "Ready in 523ms" instead of millions of minutes).
-
Sebastian "Sebbie" Silbermann authored
Last remaining workflow using our custom cancel workflow. Using the same concurrency logic as build-and-deploy
-
Tobias Koppers authored
### What? * avoid flagging tasks dirty when removing cells * For errored tasks: avoid removing cell content * For ok tasks: remove cell content later to collect more stale signals
-
- 15 Jan, 2026 11 commits
-
-
nextjs-bot authored
-
Janka Uryga authored
In Cache Components, bound args encryption needs to be cached (and tracked with cacheSignal) because it's tasky. We use the serialized bound args themselves as a cache key. However, in dev, the key ends up containing debug info (in particular, timing information) so it's different every time . This causes a cache miss and results in a static shell validation failure. The fix is to use a dummy debug channel to pipe the problematic debug info into the void and thus make the key be deterministic.
-
Steven authored
Based on our metrics, the P99.9 for a source image is 47 MB so we can adjust the default setting to be much lower (by changing from from 300 MB to 50 MB) in favor of reducing memory.
-
Tobias Koppers authored
### What? * Compute the approximate distance to leaf in the dependency graph * Prioritize tasks re-computing by distance to leaf, running leaf tasks first This ensures that it's less likely that tasks are re-executed multiple times due to bad ordering. This adresses the "diamond" problem where a task is invalidated multiple times due to multiple paths of invalidation to that task.
-
Niklas Mischkulnig authored
Introduce `TsConfigHandling::Disabled`
-
Matt Mastracci authored
-
Niklas Mischkulnig authored
-
Donny/강동윤 authored
Co-authored-by:
Claude Opus 4.5 <noreply@anthropic.com> Co-authored-by:
Niklas Mischkulnig <4586894+mischnic@users.noreply.github.com>
-
Hendrik Liebau authored
Fixes a regression from #85981 where manual deploy tests with custom tarball URLs incorrectly trigger retries and Slack notifications. Now only release-triggered runs and manually-triggered canary tests are retried/reported.
-
Tim Neutkens authored
## Summary Fixes #88291 The Pages Router fonts documentation was incorrectly showing App Router examples (`app/layout.tsx`) which don't exist in Pages Router. This confused users trying to use fonts with the Pages Router. ## Changes Updated `docs/01-app/01-getting-started/13-fonts.mdx` to include proper `<AppOnly>` and `<PagesOnly>` sections: **For Pages Router users:** - Added examples using `pages/_app.tsx` (Custom App) to wrap components with font className - Added examples using `pages/_document.tsx` (Custom Document) to apply fonts to the `<html>` element **For App Router users:** - Wrapped existing `app/layout.tsx` examples in `<AppOnly>` sections This follows the same pattern used in other shared documentation like `docs/01-app/01-getting-started/11-css.mdx` which properly separates App Router and Pages Router content.
-
Luke Sandberg authored
Add a new derive macro for `TaskStorage` a replacement for `InnerStorage` and `CachedDataItem`, currently it is unused outside of tests. ## What * add a new derive macro that generates code from the 'schema' in `storage_schema.rs` * `storage_schema.rs` defines the layout of our new struct, for each field we specify * type and name * category ('data' 'meta' or 'transient') * location (inline or lazy or flags for bitfields) * whether we should `filter_transient` when encoding (not everything can contain transient data) * Logically this is a replacement for `CachedDataItem` * From that we generate a few things * `TaskFlags` a bitfield to hold some data items as well as 'meta' information like the 'snapshot' and 'restore' bits replacing `InnerStorageState` * `LazyField` enum, defines tall the fields that we dynamically allocate * `TaskStorage` the main storage struct, along with basic accessors for all the datatypes (which helps encapsualte storage strategy) * `TaskStorageAccessors` a trait with default implementations of every accessor which also handle * access checking, via `check_access` * mutation tracking via `track_mutation` * putting these behaviors in a trait allows some of the business logic around snapshotting to remain in normal rust code that implements the trait, while all the field updating logic can be autogenerated * Serialization and encoding infrastructure * routines to encode and decode the 'meta' or 'data' subsets * routines to create partial 'snapshots' of `meta` or `data` subsets * routines to restore data from deserialized snapshots See https://gist.github.com/lukesandberg/ea35f0e92c1cdeddf80d0498f2978144 for a fully expanded version of the macro ### Why There are a few goals from this redesign of `InnerStorage` * (speculative) a single large `derive` macro will be easier to maintain than the current mix of `macro_rules` and derive macros we use for `CacheDataItem` * There is one macro to expand when inspecting and the macro generation code is pretty straightforward if voluminous * We eliminate many `match` operations on `CachedDataItem` * Today to lookup a piece of data we need to execute several matches to get the the data category and find the storage location. With this new approach those are handled by just calling the correct accessor which statically addresses the storage location * serialization performance * we don't need to 'explode' the storage into `Vec<CachedDataItem>` anymore and instead can either directly snapshot the storage or encode directly to a buffer. This should eliminate some temporary allocations and should enable a smaller serialization format * more flexibility * mostly this is the same approach as before with a few small improvements, notably `invalidator` and `immutable` are now stored as single inline bits reducing lookupcosts and memory for tasks that have these. ### How Most of the code was written by Claude with obviously a ton of feedback, so please review carefully. For now all this code is unused but future PRs will integrate it into the backend
-
- 14 Jan, 2026 1 commit
-
-
nextjs-bot authored
-