1. 31 Mar, 2026 10 commits
    • nextjs-bot's avatar
      v16.2.2 · 52faae3d
      nextjs-bot authored
      52faae3d
    • Luke Sandberg's avatar
      Backport: #92177 · 8d0f77bf
      Luke Sandberg authored
      Fixes #91708
      
      set the legacy_x86_64_support feature on qfilter to support older intel cpus
      8d0f77bf
    • Benjamin Woodruff's avatar
      Fix CI for glibc linux builds · e151e5f8
      Benjamin Woodruff authored
      e151e5f8
    • Luke Sandberg's avatar
      [backport] Fix CSS HMR on Safari (#92174) · 1a319ea4
      Luke Sandberg authored
      ## Summary
      - Backport of #92123 to `next-16-2` release branch
      - Cherry-picked the CSS HMR Safari fix and regenerated turbopack-tests
      snapshot goldens for the release branch
      
      ## Test plan
      - [x] `UPDATE=1 cargo nextest r -p turbopack-tests` — all 297 tests pass
      - [x] `pnpm build-all` — clean build, no issues with
      `generated-native.d.ts`
      1a319ea4
    • Will Binns-Smith's avatar
      Turbopack: exclude metadata routes from server HMR (#92034) · c0edad27
      Will Binns-Smith authored
      ### What?
      
      Metadata routes (`manifest.ts`, `robots.ts`, `sitemap.ts`, `icon.tsx`,
      `apple-icon.tsx`, etc.) were not being hot-reloaded in Turbopack dev
      mode — changes to those files would not be reflected on subsequent
      requests until a full server restart.
      
      ### Why?
      
      PR #91466 extended `usesServerHmr = true` in `clearRequireCache()` (in
      `hot-reloader-turbopack.ts`) from `app-page` entries only to **all**
      `app`-type entries (pages + route handlers). The motivation was correct:
      regular route handlers like `app/api/hello/route.ts` use Turbopack's
      in-place module update model and benefit from server HMR.
      
      However, metadata routes (`/manifest.webmanifest/route`,
      `/robots.txt/route`, etc.) are also `app`-type entries but they are
      **not** suitable for in-place server HMR. When `usesServerHmr = true`
      for a metadata route, `clearRequireCache()` skips two critical
      invalidation steps:
      
      1. Deleting the compiled chunk from `require.cache`
      2. Calling `__next__clear_chunk_cache__()`
      
      Without those steps, the old module stays in-memory and all subsequent
      requests to `/manifest.webmanifest` (etc.) return the stale content.
      
      ### How?
      
      Added an `!isMetadataRoute(entryPage)` guard to the `usesServerHmr`
      expression in `clearRequireCache()`. This restores full cache
      invalidation for metadata routes on every rebuild while leaving regular
      route handler server HMR (added in #91466) intact.
      
      ```ts
      // Before
      const usesServerHmr =
        serverFastRefresh &&
        entryType === 'app' &&
        writtenEndpoint.type !== 'edge'
      
      // After
      const usesServerHmr =
        serverFastRefresh &&
        entryType === 'app' &&
        writtenEndpoint.type !== 'edge' &&
        !isMetadataRoute(entryPage)   // ← metadata routes always clear the cache
      ```
      
      `isMetadataRoute('/manifest.webmanifest/route')` → `true` (excluded from
      server HMR)
      `isMetadataRoute('/api/hello/route')` → `false` (keeps server HMR, no
      regression)
      
      Also added a regression test: `metadata route hmr > reflects manifest.ts
      changes on fetch/refresh` in the `server-hmr` test suite, with a
      `manifest.ts` fixture that starts at `name: 'Version 0'`. The test
      patches the file and asserts the updated JSON is returned on the next
      fetch.
      
      Fixes #91981
      
      ---------
      Co-authored-by: 's avatarWill Binns-Smith <wbinnssmith@users.noreply.github.com>
      Co-authored-by: 's avatarClaude <noreply@anthropic.com>
      c0edad27
    • Will Binns-Smith's avatar
      Turbopack: enable server HMR for app route handlers (#91466) · d6446990
      Will Binns-Smith authored
      App router handlers are already built with the Turbopack runtime, so
      they can use server HMR. **We also already get subscription events for
      their chunks.** However, unlike app pages which use
      `__next_app__.require()` for dynamic devModuleCache lookup, route
      handlers capture userland exports statically in AppRouteRouteModule at
      construction time. This change makes routes behave a lot like pages,
      dynamically loading the user's code when requests are made. This way, we
      can freely invalidate and reload it when changes are made without
      evicting the entire require cache.
      
      Only `next dev` uses this lazy evaluation, as `next start` continues to
      eagerly import route handlers.
      
      This change removes the `isAppPage` restriction from `usesServerHmr`,
      extending server HMR coverage to all App Router entries (pages and route
      handlers) built with the Node.js runtime.
      
      For route handlers, we also clear the entry chunk from Node.js
      `require.cache` on each rebuild so the next `requirePage()` call
      re-executes the entry and obtains fresh module exports from
      `devModuleCache` (which HMR updates in-place).
      
      Test Plan: Added an additional e2e test, `with-dep`
      d6446990
    • Will Binns-Smith's avatar
      next.config.js: Accept an option for serverFastRefresh (#91968) · 34de2cac
      Will Binns-Smith authored
      ### What?
      
      Adds `experimental.serverFastRefresh` to `next.config.js` so users (and
      Next.js plugins) can opt out of server-side Fast Refresh without needing
      to pass a CLI flag.
      
      Also adds a `--server-fast-refresh` positive CLI flag (hidden) alongside
      the existing `--no-server-fast-refresh`, and emits a warning when the
      CLI flag and config value conflict. This is a necessary implementation
      detail for `commander` to detect when no option is provided.
      
      ### Why?
      
      Certain Next.js plugins have encountered issues with server Fast Refresh
      and need a way to disable it programmatically via config rather than
      requiring users to modify their start scripts. The CLI-only opt-out
      (`--no-server-fast-refresh`) was insufficient for this use case.
      
      ### How?
      
      - **`config-shared.ts` / `config-schema.ts`**: Added
      `experimental.serverFastRefresh?: boolean` to the `ExperimentalConfig`
      type and Zod schema.
      - **`router-server.ts`**: Resolves the effective `serverFastRefresh`
      value at startup by combining the CLI flag (`opts.serverFastRefresh`)
      and `nextConfig.experimental.serverFastRefresh`, with CLI taking
      precedence. Emits a `Log.warn` when both are set to conflicting values.
      Defaults to `true` when neither is specified.
      - **`bin/next.ts`**: Fixed the Commander option definition for
      `--no-server-fast-refresh`. Commander's `--no-X` pattern implicitly
      creates a positive `--server-fast-refresh` option defaulting to `true`,
      which meant `opts.serverFastRefresh` was never `undefined` and the
      config value could never take effect. Fixed by explicitly registering a
      hidden `--server-fast-refresh` option with `.default(undefined)`.
      - **Tests**: Added two new test suites in
      `test/development/app-dir/server-hmr/server-hmr.test.ts`:
      - `server-hmr config opt-out` — verifies that setting
      `experimental.serverFastRefresh: false` in config causes unmodified
      dependencies to be re-evaluated (i.e., server HMR is disabled).
      - `server-hmr CLI/config conflict warning` — verifies that passing
      `--no-server-fast-refresh` when config has `serverFastRefresh: true`
      logs the conflict warning.
      
      ### Test Plan
      
      - [x] Added e2e development tests
      (`test/development/app-dir/server-hmr/server-hmr.test.ts`) — all 8 tests
      pass
      
      ---------
      Co-authored-by: 's avatarWill Binns-Smith <wbinnssmith@users.noreply.github.com>
      Co-authored-by: 's avatarClaude <noreply@anthropic.com>
      34de2cac
    • Jude Gao's avatar
      [create-next-app] Skip interactive prompts when CLI flags are provided (#91840) · c4779d1b
      Jude Gao authored
      When AI agents run `create-next-app` with explicit flags like
      `--typescript --tailwind --eslint --app --src-dir`, the CLI still enters
      interactive mode and prompts for any unspecified options:
      
      ```
      ➜ npx create-next-app my-app --typescript --tailwind --eslint --app --src-dir --use-pnpm
      ✔ Would you like to use React Compiler? … No / Yes
      ✔ Would you like to customize the import alias (`@/*` by default)? … No / Yes
      ? Would you like to include AGENTS.md to guide coding agents to write up-to-date Next.js code? › No / Yes
      ```
      
      Agents can sometimes answer these interactive prompts correctly, but
      often they can't. When they fail to navigate the prompts, they fall back
      to scaffolding the project themselves from scratch — generating files
      based on stale training data. This means they might initialize an app
      using deprecated patterns or pin to an older version of Next.js (e.g.
      15) instead of the latest. Using `create-next-app` non-interactively is
      the best way to ensure agents always produce up-to-date scaffolding.
      
      Previously, `hasProvidedOptions` only skipped the initial "use
      recommended defaults?" meta-prompt but still showed individual prompts
      for each missing option. Now when any config flags are provided, all
      remaining options use the recommended defaults without prompting.
      
      The resolved defaults are printed to stdout so the caller knows exactly
      what was assumed and which flags to pass to override:
      
      ```
      Using defaults for unprovided options:
      
        --eslint                ESLint (use --biome for Biome, --no-eslint for None)
        --no-react-compiler     No React Compiler (use --react-compiler for React Compiler)
        --agents-md             AGENTS.md (use --no-agents-md for No AGENTS.md)
        --import-alias          "@/*"
      
      To customize, re-run with explicit flags.
      ```
      
      The `displayConfig` array is extended with a `flags` field so this
      output is auto-generated from the same source of truth used for the
      interactive prompts. Existing behavior for `--yes`, CI mode, and fully
      interactive mode (no flags) is unchanged.
      c4779d1b
    • JJ Kasper's avatar
    • JJ Kasper's avatar
      backport: Move expanded adapters docs to API reference (#92115) (#92129) · eee3f524
      JJ Kasper authored
      ## Summary
      - move adapter implementation docs from
      `app/api-reference/config/next-config-js/adapters` to
      `app/api-reference/adapters`
      - keep `adapterPath` as an entry page that points to the new adapters
      section
      - add matching Pages Router pointer docs under
      `pages/api-reference/adapters`
      - update existing docs links that referenced old `adapterPath#...`
      anchors to the new adapters routes
      
      <!-- Thanks for opening a PR! Your contribution is much appreciated.
      To make sure your PR is handled as smoothly as possible we request that
      you follow the checklist sections below.
      Choose the right checklist for the change(s) that you're making:
      
      ## For Contributors
      
      ### Improving Documentation
      
      - Run `pnpm prettier-fix` to fix formatting issues before opening the
      PR.
      - Read the Docs Contribution Guide to ensure your contribution follows
      the docs guidelines:
      https://nextjs.org/docs/community/contribution-guide
      
      ### Fixing a bug
      
      - Related issues linked using `fixes #number`
      - Tests added. See:
      https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs
      - Errors have a helpful link attached, see
      https://github.com/vercel/next.js/blob/canary/contributing.md
      
      ### Adding a feature
      
      - Implements an existing feature request or RFC. Make sure the feature
      request has been accepted for implementation before opening a PR. (A
      discussion must be opened, see
      https://github.com/vercel/next.js/discussions/new?category=ideas)
      - Related issues/discussions are linked using `fixes #number`
      - e2e tests added
      (https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs)
      - Documentation added
      - Telemetry added. In case of a feature if it's used or not.
      - Errors have a helpful link attached, see
      https://github.com/vercel/next.js/blob/canary/contributing.md
      
      
      ## For Maintainers
      
      - Minimal description (aim for explaining to someone not on the team to
      understand the PR)
      - When linking to a Slack thread, you might want to share details of the
      conclusion
      - Link both the Linear (Fixes NEXT-xxx) and the GitHub issues
      - Add review comments if necessary to explain to the reviewer the logic
      behind a change
      
      ### What?
      
      ### Why?
      
      ### How?
      
      Closes NEXT-
      Fixes #
      
      -->
      eee3f524
  2. 26 Mar, 2026 1 commit
  3. 20 Mar, 2026 10 commits
    • nextjs-bot's avatar
      v16.2.1 · ed7d2cef
      nextjs-bot authored
      ed7d2cef
    • Joseph's avatar
      docs: post release amends (#91715) · 3e37bb42
      Joseph authored
      Fixes based on feedback post release
      
      Fixes: https://github.com/vercel/next.js/pull/91715
      3e37bb42
    • Abhishek Mardiya's avatar
      docs: fix broken Activity Patterns demo link in preserving UI state guide (#91698) · a15ec6e9
      Abhishek Mardiya authored
      ## What?
      
      Fixes a broken link in the Preserving UI State guide:
      https://nextjs.org/docs/app/guides/preserving-ui-state#examples
      
      The "Activity Patterns demo" link currently points to a non-working URL.
      
      ## Why?
      
      The demo link returns a 404 / invalid page, which makes the example
      section confusing for readers.
      
      ## Changes
      
      - Updated the Activity Patterns demo link to the correct URL.
      
      ## Notes
      
      No functional changes, docs only.
      
      @icyJoseph @delbaoliveira
      a15ec6e9
    • JJ Kasper's avatar
      Fix adapter outputs for dynamic metadata routes (#91680) · 600cd2fe
      JJ Kasper authored
      ## Summary
      
      This fixes adapter `onBuildComplete` outputs for dynamic metadata
      routes.
      
      ## Bug
      
      `handleBuildComplete` skipped metadata routes too aggressively via
      `isStaticMetadataFile(...)`, so dynamic metadata routes (for example
      `robots.txt` / `sitemap.xml` using `connection()`) were omitted from
      `outputs.appRoutes`.
      
      ## Fix
      
      Only skip metadata routes when they are actually prerendered/static
      (present in prerender manifests). Dynamic metadata routes are now
      included in adapter `outputs.appRoutes` as expected.
      
      ## Tests
      
      Added e2e coverage in `test/e2e/app-dir/adapter-dynamic-metadata`:
      - verifies dynamic `robots.txt`, `sitemap.xml`, and `favicon.ico`
      functionality
      - verifies adapter output classification for non-deploy runs
      - skips output-shape verification in deploy mode
      - skips the suite in dev mode
      600cd2fe
    • Niklas Mischkulnig's avatar
      Turbopack: fix webpack loader runner layer (#91727) · 27886d3c
      Niklas Mischkulnig authored
      Otherwise you get a `Dependency tracking is disabled` / infinite loop
      when trying to use both turbopack.rules.loader and turbopackLoader at
      the same time
      27886d3c
    • Hendrik Liebau's avatar
      Fix server actions in standalone mode with `cacheComponents` (#91711) · 88fc4308
      Hendrik Liebau authored
      The `staticPathKey` condition added in #91231 inadvertently applies to
      server action requests on dynamic SSG routes when `cacheComponents` is
      enabled.
      
      Server action fetch requests from the client do not send the `RSC`
      header (`rsc: 1`). They only send `Accept: text/x-component` and the
      `Next-Action` header. This means `isRSCRequest` and
      `isDynamicRSCRequest` are both `false` for action requests. The new
      `staticPathKey` condition (`isSSG && pageIsDynamic &&
      prerenderInfo?.fallbackRouteParams`) evaluates to `true` for dynamic PPR
      routes, setting `staticPathKey` even though `ssgCacheKey` is `null` for
      actions.
      
      With `staticPathKey` set, the request enters the fallback rendering
      block, which serves the cached fallback HTML shell with the action
      result appended to it, instead of responding with just the RSC action
      result.
      
      The fix excludes server action requests from the `staticPathKey`
      computation by adding `!isPossibleServerAction` to the condition,
      restoring the pre-#91231 behavior where `staticPathKey` was always
      `null` for server actions in production.
      
      fixes #91662
      closes #91677
      closes #91669
      88fc4308
    • Tobias Koppers's avatar
      turbo-persistence: remove Unmergeable mmap advice (#91713) · 37aed862
      Tobias Koppers authored
      Remove the `MADV_UNMERGEABLE` (Unmergeable) mmap advice from
      `turbo-persistence`'s `advise_mmap_for_persistence` helper in
      `mmap_helper.rs`.
      
      The WSL (Windows Subsystem for Linux) kernel does not support
      `MADV_UNMERGEABLE` and returns an error when it is applied, causing
      turbo-persistence to fail on WSL. See:
      https://x.com/von_cronen/status/2034944304712392891
      
      Additionally, `MADV_UNMERGEABLE` is already the **default** state for
      memory pages — KSM (Kernel Same-page Merging) is opt-in via
      `MADV_MERGEABLE`. Explicitly setting `MADV_UNMERGEABLE` on pages that
      were never marked mergeable is a no-op on standard kernels, so the call
      provides no benefit while breaking WSL users.
      
      The `MADV_DONTFORK` advice is retained, as it has a clear correctness
      benefit (prevents mmap regions from being inherited by child processes
      on `fork()`).
      
      Removed the `mmap.advise(memmap2::Advice::Unmergeable)` call and its
      associated doc comment from
      `turbopack/crates/turbo-persistence/src/mmap_helper.rs`.
      Co-authored-by: 's avatarTobias Koppers <sokra@users.noreply.github.com>
      Co-authored-by: 's avatarClaude <noreply@anthropic.com>
      37aed862
    • Tobias Koppers's avatar
      Fix layout segment optimization: move app-page imports to server-utility transition (#91701) · d6195eca
      Tobias Koppers authored
      ## Summary
      
      - Add `'turbopack-transition': 'next-server-utility'` to all server-side imports in the `app-page.ts` template so they are properly placed in the server utility layer, rather than relying on `SharedMerged` chunk groups to handle them
      - Remove the now-unnecessary `next-server-utility` transition from `fillMetadataSegment` import in `app_page_loader_tree.rs`
      - Add `SharedMultiple` chunk group variant to support multiple shared entries without a merge tag
        - This avoid passing the `parent` into `SharedMerged`, which did break the layout segment optimization.
      - Refactor `app_module_graphs` to combine `client_shared_entries` + `has_layout_segments` into a single `Option` parameter, simplifying the API and removing the dead code path for non-page endpoints
      
      ## Test plan
      
      - [ ] Verify dev and production builds work with app pages that have layout segments
      - [ ] Verify route handlers still build correctly (no client runtime entries passed)
      - [ ] Run existing app-dir e2e tests
      d6195eca
    • Niklas Mischkulnig's avatar
      Turbopack: lazy require metadata and handle TLA (#91705) · 6cb97d6d
      Niklas Mischkulnig authored
      A regression from #88487
      
      1. Make metadata import lazy with `() => require()`, just like for the layout segments
      2. Properly await the return value to better handle TLA modules
      
      This align with Webpack which does this:
      
      <img width="1535" height="509" alt="Bildschirmfoto 2026-03-20 um 11 58 00" src="https://github.com/user-attachments/assets/f2864c86-ccce-4884-8417-c8ae06c05f78" />
      
      
      Closes PACK-6927
      Closes #91700
      Closes https://github.com/vercel/next.js/issues/91676
      6cb97d6d
    • Luke Sandberg's avatar
      [turbopack] Respect `{eval:true}` in worker_threads constructors (#91666) · e6b101ae
      Luke Sandberg authored
      ### What?
      
      Fixed Turbopack incorrectly trying to resolve inline JavaScript code as module references when `new Worker()` is called with `{ eval: true }` option.
      
      Now we skip creating a reference when `eval:true`, and report warnings if we cannot tell what the value is
      
      ### Why?
      
      Libraries like jsPDF create Worker threads by passing inline JavaScript code as the first argument along with `{ eval: true }` as the second argument. Turbopack was incorrectly treating this inline code as a file path and attempting to resolve it as a module reference, causing build failures.
      
      ### How?
      
      Added logic to detect when the `eval: true` option is passed to the Worker constructor. When this option is present, Turbopack now skips creating a worker reference since the first argument contains executable code rather than a file path. Added comprehensive test coverage using jsPDF to verify the fix works correctly.
      
      Fixes #91642
      e6b101ae
  4. 18 Mar, 2026 9 commits
  5. 17 Mar, 2026 10 commits