- 13 Aug, 2025 28 commits
-
-
nextjs-bot authored
-
Jam Balaya authored
## Summary Fix typos and spelling errors in various MDX documentation files to improve clarity and consistency. Documentation: - Standardize 'cacheable' spelling across self-hosting guide - Correct 'potentionally' to 'potentially' in image component references - Fix 'unecessary' to 'unnecessary' in use-link-status guide ### Improving Documentation - [x] Run `pnpm prettier-fix` to fix formatting issues before opening the PR. - [x] Read the Docs Contribution Guide to ensure your contribution follows the docs guidelines: https://nextjs.org/docs/community/contribution-guideCo-authored-by:
Joseph <joseph.chamochumbi@vercel.com>
-
Jiachi Liu authored
-
Guo Ci authored
<!-- 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 ### Adding or Updating Examples - The "examples guidelines" are followed from our contributing doc https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md - Make sure the linting passes by running `pnpm build && pnpm lint`. See https://github.com/vercel/next.js/blob/canary/contributing/repository/linting.md ### 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 # --> Co-authored-by:
Joseph <joseph.chamochumbi@vercel.com>
-
Joseph authored
Attempt at fixing from our side: https://github.com/vercel/next.js/issues/82577 Rather, the issue is that when the project is at the root of the file system - `findRootDir` loops indefinitely, and we keep pushing to the lockFiles found. I also noticed the warning claims we use the last lockfile found, but we return `dirname(lockfile)` - that is the first lock file found. Regardless, when using this project setup: ```console . ├── apps │ └── frontend │ ├── README.md │ ├── next.config.ts │ ├── package.json │ ├── pnpm-lock.yaml │ ├── src │ │ └── app │ │ ├── globals.css │ │ ├── layout.tsx │ │ └── page.tsx │ └── tsconfig.json ├── package.json ├── pnpm-lock.yaml └── pnpm-workspace.yaml ``` Running `pnpm --filter frontend dev` still ends up in panic: `Error [TurbopackInternalError]: Next.js package not found` - Maybe that's still expected :) As for https://github.com/vercel/next.js/issues/82577 - a way for them to get unblocked is to use a `WORKDIR`. More details on that issue thread. --------- Co-authored-by:
Luke Sandberg <lukesandberg@users.noreply.github.com>
-
nextjs-bot authored
-
Ben Gubler authored
## Overview Generates `.next/types/validator.ts` - a single TypeScript file that validates all route exports using the `satisfies` operator. Replaces the old `next-types-plugin` webpack plugin. ## Why needed - **Turbopack compatibility**: Old webpack plugin didn't work with Turbopack - **Performance**: Single large file vs hundreds of small validation files - **Type safety**: Catches invalid exports like `dynamic = 'invalid-value'` ## Validation Structure ```typescript // Type definitions type PageConfig = { default: React.ComponentType<any> config?: {} generateMetadata?: (props: any, parent: any) => Promise<any> | any dynamic?: 'auto' | 'force-dynamic' | 'error' | 'force-static' // ... other Next.js exports } // Validation checks // Validate app/page.tsx { const handler = {} as typeof import("../../app/page") handler satisfies PageConfig } ... ``` ## Example Usage ```typescript // app/blog/[slug]/page.tsx export const dynamic = 'some-random-string' // ← Type error caught! export default async function BlogPostPage(props: PageProps<'/blog/[slug]'>) { const params = await props.params return <div>Blog Post: {params.slug}</div> } ``` ## Key Benefits - **Build-time validation**: Catches invalid route exports during TypeScript compilation - **Turbopack support**: Works with both webpack and Turbopack - **Better performance**: One file instead of hundreds of small type guard files -
Vercel Release Bot authored
This auto-generated PR updates the development integration test manifest used when testing Rspack.
-
Vercel Release Bot authored
This auto-generated PR updates the production integration test manifest used when testing Rspack.
-
Niklas Mischkulnig authored
Co-authored-by:vercel[bot] <35613825+vercel[bot]@users.noreply.github.com>
-
Hendrik Liebau authored
In #81162 we removed the support for accessing request data synchronously when `experimental.cacheComponents` is enabled. However, we missed updating the `cookies()` and `headers()` promises that are created at runtime to not be "exotic" promises, i.e. promises that also have the cookies/headers methods defined on them. Those two cases are now updated as well with this PR. (Params, search params, and draft mode were already handled correctly in the original PR.) In the next major version we'll remove the support for the legacy synchronous access independent of the `cacheComponents` flag.
-
Luke Sandberg authored
Drop the scare text about not running turbopack in production. Instead clarify that builds are beta and direct people to our documentation site. For example:  Compared to the old notice:  Notably * mission critical applications are a good idea! just be careful with compatibility issues * the source maps issues is fixed! no need to talk about it at all * A discussion of bundle size issues and build caches is being added in #82560 Closes PACK-5237
-
Niklas Mischkulnig authored
Turbopack fails to resolve this ```js function requireOrgPkg(s) { return require(`@org/pkg-${s}`) } ``` which is needed for the case of ```js require(`@img/sharp-${currentArch()}/sharp.node`) ``` -
Sebastian "Sebbie" Silbermann authored
-
Zack Tanner authored
The deprecation warning code is fairly brittle right now since there's a mixture of calling things with `userConfig` and `result`. It was assumed that `userConfig` was the actual user-provided configuration, but it turns out it's actually the default configuration when a user configuration isn't specified. This moves all the deprecation checks to be before we actually do any sort of merging. This restores the intent behind `userConfig` and will prevent deprecation warnings from being logged due to defaults. Alternative to #82593
-
Sebastian "Sebbie" Silbermann authored
Co-authored-by:Hendrik Liebau <mail@hendrik-liebau.de>
-
Andrew Clark authored
When there is no matching route tree in the prefetch cache, before we de-opt to a blocking navigation, we will first attempt to construct an "optimistic" route tree by checking the cache for routes are likely to be similar to the one we're missing. If there's a route with the same pathname, but with different search params, we can base our optimistic route on that entry. Conceptually, we are simulating what would happen if we did perform a prefetch the requested URL, under the assumption that the server will not redirect or rewrite the request in a different manner than the base route tree. This assumption might not hold, in which case we'll have to recover when we perform the dynamic navigation request. However, this is what would happen if a route were dynamically rewritten/ redirected in between the prefetch and the navigation. So the logic needs to exist to handle this case regardless. The implementation in this PR is a bit of an incremental step; it's not as general as it should be. Notably, it will bail out if the base route tree contains dynamic metadata, because we currently don't store the route tree separately from the metadata. We are also currently special-casing prefetch entries with an empty search string. To take advantage of the optimistic prefetch behavior, there must be a prefetch entry for the target URL with no search params, e.g. to navigate to a page at `/target-page?search=foobar`, you must first prefetch `/target-page` (no search string). This is a somewhat arbitrary limitation chosen as a concession to implementation complexity; the empty search string is only used because it's the one that's most likely to already be cached. We will generalize this later to match any search string. I've added some TODO comments to describe the work necessary to enable this mechanism in more cases. Co-authored-by:Zack Tanner <1939140+ztanner@users.noreply.github.com>
-
Tobias Koppers authored
### What? Avoid mixing rayon and tokio. Only use tokio. Implemented parallel for_each and map on top of tokio. Closes PACK-5158
-
Joseph authored
Closes: https://linear.app/vercel/issue/DOC-4949/clarification-redirecting-in-server-actions-to-self, https://linear.app/vercel/issue/DOC-4973/global-error-and-global-not-found-in-prod-checklist Additionally addresses community confusion and feedback around Server Functions initial client side sequential processing.
-
Sebastian "Sebbie" Silbermann authored
`allReady` is available in all supported React versions so we can remove the conditional check. The helper type can be replaced with the actual type from React.
-
Sebastian "Sebbie" Silbermann authored
Our shadow root was always defined but each callsite guarded against the portal and therefore the shadow root not being defined. This caution also required authoring cascading updates. All of this is not required. We just expose the ShadowRoot in context so that everybody can use it directly.
-
Niklas Mischkulnig authored
We were (unnecessarily) calling `is_self_async()` even for the traced externals (the directly referenced ones, not transitively). This created a bottleneck during the global information computation: <img width="2560" height="1315" alt="Bildschirmfoto 2025-08-13 um 09 50 19" src="https://github.com/user-attachments/assets/4f5d1fa6-3d65-40b2-875e-8a4a579b234b" /> `compute_async_module_info_single` calls `is_self_async` for every single module, regardless of whether the computed value is actually used or not (the traced modules have `ChunkingType::Traced`, so they'd never cause any importers to be async anyway). So manually optimize this case by overriding `is_self_async` for traced externals. This defers the parsing to emitting which is much more parallel: <img width="2560" height="1315" alt="Bildschirmfoto 2025-08-13 um 09 51 23" src="https://github.com/user-attachments/assets/820c7157-7fe0-4253-b02f-1e0d2a8c7e7d" />
-
Luke Sandberg authored
Address a crash found at head when testing caching while switching back and forth from `dev` and `build`. ``` thread '<unnamed>' panicked at turbopack/crates/turbo-persistence/src/db.rs:798:17: attempt to subtract with overflow stack backtrace: 0: __rustc::rust_begin_unwind 1: core::panicking::panic_fmt 2: core::panicking::panic_const::panic_const_sub_overflow 3: <core::iter::adapters::map::Map<core::slice::iter::Iter<alloc::vec::Vec<<turbo_persistence::db::TurboPersistence>::compact_internal::SstWithRange>>, <turbo_persistence::db::TurboPersistence>::compact_internal::{closure#2}> as core::iter::traits::iterator::Iterator>::fold::<(), core::iter::traits::iterator::Iterator::for_each::call<alloc::vec::Vec<smallvec::SmallVec<[usize; 1]>>, <alloc::vec::Vec<alloc::vec::Vec<smallvec::SmallVec<[usize; 1]>>>>::extend_trusted<core::iter::adapters::map::Map<core::slice::iter::Iter<alloc::vec::Vec<<turbo_persistence::db::TurboPersistence>::compact_internal::SstWithRange>>, <turbo_persistence::db::TurboPersistence>::compact_internal::{closure#2}>>::{closure#0}>::{closure#0}> 4: <alloc::vec::Vec<alloc::vec::Vec<smallvec::SmallVec<[usize; 1]>>> as alloc::vec::spec_from_iter_nested::SpecFromIterNested<alloc::vec::Vec<smallvec::SmallVec<[usize; 1]>>, core::iter::adapters::map::Map<core::slice::iter::Iter<alloc::vec::Vec<<turbo_persistence::db::TurboPersistence>::compact_internal::SstWithRange>>, <turbo_persistence::db::TurboPersistence>::compact_internal::{closure#2}>>>::from_iter 5: <turbo_persistence::db::TurboPersistence>::compact ``` Scenario: * build turbopack and next * cd bench/module-cost * enable persistent caching * pnpm i * pnpm dev-turbopack * load localhost:3000 and click all the buttons * pnpm build-turbopack * pnpm dev-turbopack * load localhost:3000 and see the crash ## What? The `get_merge_segments` function and its caller had a different idea about what `max_merge_segment_count` means. Unify how this is accounted to avoid underflow. -
nextjs-bot authored
-
nextjs-bot authored
[diff facebook/react@1dc3bdea...f1222f76](https://github.com/facebook/react/compare/1dc3bdea...f1222f76) <details> <summary>React upstream changes</summary> - https://github.com/facebook/react/pull/34183 - https://github.com/facebook/react/pull/34192 - https://github.com/facebook/react/pull/34186 - https://github.com/facebook/react/pull/34187 </details>
-
nextjs-bot authored
-
Jude Gao authored
The `key` prop on `<Head>` component differs during prerender and a PPR resume because of search params being part of the key, causing the resume to treat them as distinct components, hence the error\*. However, it is necessary semantically to include search params in the key for `<Head>`, so we will remove the search params from the key during the resume SSR. \*Mismatch Error: ``` ⨯ [Error: Couldn't find all resumable slots by key/index during replaying. The tree doesn't match so React will fallback to client rendering.] ```
-
Zack Tanner authored
When middleware sets a `Location` header on the response, we should not assume that the target URL is the one we want to handle the request. We only want to route to the underlying location header when a rewrite is explicitly triggered rather than relying on the presence of the response header. --------- Co-authored-by:JJ Kasper <jj@jjsweb.site>
-
- 12 Aug, 2025 12 commits
-
-
nextjs-bot authored
-
Niklas Mischkulnig authored
Closes PACK-5239 https://vercel.slack.com/archives/C04RPSD7EPM/p1753968554253779
-
Zack Tanner authored
`unstable_rootParams()` is deprecated in favor of importing specific params from `next/root-params`. This also requires enabling the experimental feature in nextConfig via `experimental.rootParams`.
-
Benjamin Woodruff authored
Noticed while skimming over this code. It looks like `react-loadable` had a separate `Loadable.Map` API (https://github.com/jamiebuilds/react-loadable/tree/master?tab=readme-ov-file#loading-multiple-resources), but `next/dynamic` doesn't, so we shouldn't check for this. The SWC version of this transform doesn't appear to have copied this code, and doesn't have the `Map` logic.
-
Hendrik Liebau authored
When a page component (or a parallel route slot) is cached, but other parts of the component tree are dynamic, we generate a partially static shell at buildtime that's resumed at runtime. During the resume, we need to ensure that the cache key is the same as during prerendering. This is currently not the case because we automatically include the (unused) `searchParams` prop in the cache key. Its value is a hanging promise during prerendering, and a resolving promise at runtime, leading to a cache miss when looking up the cached page data in the Resume Data Cache (RDC). Subsequently, hydration errors might occur when the recomputed result is different than the prerendered result. Since search params are not allowed to be read in public cache scopes anyways, we can pass erroring search params into the cached page, instead of using a hanging promise, and omit them from the generated cache key. We already used this technique when `cacheComponents` is not enabled. closes NAR-87
-
Benjamin Woodruff authored
- Did my best to reduce the amount of stuff that's `any`-typed. - Add comments for bare null or boolean arguments - The loader was doing `.call(...)` to set `this` all over the place. Pass it as an explicit argument instead.
-
Jiwon Choi authored
-
Vercel Release Bot authored
This auto-generated PR updates the production integration test manifest used when testing Rspack.
-
Vercel Release Bot authored
This auto-generated PR updates the development integration test manifest used when testing Rspack.
-
Janka Uryga authored
In a runtime prefetch, sync IO is dangerous, because it makes us abort the whole prerender. If this abort happens early, a runtime prefetch can end up giving us *less* data than a static prefetch. To prevent this, we can split the final prerender into two separate tasks (which i'm calling "stages" in the code): 1. The static stage (task 1). This is meant to be equivalent to what we'd do during build, so runtime APIs like `cookies()` aren't resolved yet. This lets us render everything that's reachable statically. We should not hit a sync IO here -- if we had, it would've also caused an error during build. 2. The runtime stage (task 2). Here, we allow `cookies()` (and all other runtime APIs available in a runtime prerender) to resolve. We might encounter sync IO errors here (e.g. `await cookies(); Date.now()`), which will make the result suboptimal, but still usable.
-
nextjs-bot authored
-
Ben Gubler authored
# Typed Links: Turbopack support This PR replaces the old `experimental.typedRoutes` implementation with a new approach that works on both Turbopack and Webpack. _Note: a previous version of this PR contained new props for the `Link` component: `path`, `params`, and `searchParams`. In the interest of bringing typed links support to Turbopack as soon as possible, I've removed that change from this PR and will create a new one later._
-