1. 19 Jan, 2026 2 commits
  2. 17 Jan, 2026 4 commits
  3. 16 Jan, 2026 24 commits
    • Luke Sandberg's avatar
      [turbopack] Add bundling support for worker_threads (#87746) · 09296125
      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.
      09296125
    • nextjs-bot's avatar
      v16.1.1-canary.31 · 05406f6e
      nextjs-bot authored
      05406f6e
    • Benjamin Woodruff's avatar
    • jgeschwendt's avatar
      fix: capture promisified setImmediate separately (#88346) · 5a12867c
      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.
      5a12867c
    • Will Binns-Smith's avatar
      Turbopack: use bugs.nextjs.org for Turbopack panic error reports (#88356) · d3b3e3a3
      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.
      d3b3e3a3
    • Tobias Koppers's avatar
      Turbopack: add support for matching loaders on resource queries (#88644) · 7e9d7cbd
      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' },
            ],
          },
        },
      }
      ```
      7e9d7cbd
    • Neha Prasad's avatar
      fix: make RedirectType constant properties literal types (#88653) · 5ad737c9
      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: 's avatarZack Tanner <1939140+ztanner@users.noreply.github.com>
      5ad737c9
    • nextjs-bot's avatar
    • nextjs-bot's avatar
      v16.1.1-canary.30 · f67bc23b
      nextjs-bot authored
      f67bc23b
    • Tobias Koppers's avatar
      Turbopack: add caching to chunking (#88561) · c38e57fd
      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)
      c38e57fd
    • Tobias Koppers's avatar
      Turbopack: use selective reads for merged modules (#88560) · a8b0f9db
      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.
      a8b0f9db
    • Tobias Koppers's avatar
      Turbopack: selective read for module_chunk_groups in ChunkGroupInfo (#88559) · bbf8aec9
      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.
      bbf8aec9
    • Jiachi Liu's avatar
      8cfdcacf
    • Jiachi Liu's avatar
      feat: server action logging (#88277) · 3aad67b7
      Jiachi Liu authored
      3aad67b7
    • Tobias Koppers's avatar
      Turbopack: MappedReadRef should be Send and Sync (#88558) · 43460b17
      Tobias Koppers authored
      ### What?
      
      To be able to used MappedReadRefs in async context, they need to be Send.
      43460b17
    • Tobias Koppers's avatar
      Turbopack: avoid chunk_item_id task and use selective cell access instead (#88411) · 8d5b9374
      Tobias Koppers authored
      ### What?
      
      Use selection reads for module id to avoid functions
      8d5b9374
    • Tobias Koppers's avatar
      Turbopack: follow tracing spans through aggregation update queue (#88410) · dd39efc7
      Tobias Koppers authored
      ### What?
      
      follow spans through the aggregation update queue
      dd39efc7
    • Tobias Koppers's avatar
      Turbopack: Consistency for compute_async_module_info (#88409) · 22fb1a01
      Tobias Koppers authored
      ### What?
      
      Use strongly consistent reads for compute_async_module_info to avoid double execution.
      22fb1a01
    • Tobias Koppers's avatar
      Turbopack: snapshot the ModuleGraph to avoid (eventual) inconsistent graphs (#88340) · cfe29f98
      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.
      cfe29f98
    • Tobias Koppers's avatar
      Turbopack: unflake unit test (#88620) · 8ae72f2a
      Tobias Koppers authored
      ### What?
      
      Too few tasks leave no space for tokio to act.
      8ae72f2a
    • Jiachi Liu's avatar
      doc: add details of mcp client integration (#88543) · 9fccecc3
      Jiachi Liu authored
      add link to the mcp client configuration details section before the code
      block of example
      
      ---------
      Co-authored-by: 's avatarVercel <vercel[bot]@users.noreply.github.com>
      Co-authored-by: 's avatartimneutkens <tim@timneutkens.nl>
      9fccecc3
    • Tim Neutkens's avatar
      Fix incorrect 'Ready in' time for next start (#88589) · 166e0ef3
      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).
      166e0ef3
    • Sebastian "Sebbie" Silbermann's avatar
      [ci] Use native `concurrency` feature in build-and-test (#87287) · 52b2b8be
      Sebastian "Sebbie" Silbermann authored
      Last remaining workflow using our custom cancel workflow.
      
      Using the same concurrency logic as build-and-deploy
      52b2b8be
    • Tobias Koppers's avatar
      Turbopack: avoid removing cells for erroring tasks (#88305) · fcfcbce3
      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
      fcfcbce3
  4. 15 Jan, 2026 10 commits