- 03 Sep, 2025 25 commits
-
-
nextjs-bot authored
-
Jakob Klotz authored
### What? Expanded the `with-docker` example for usage with `bun` and added build instructions to the README. ### Why? The existing example supports npm, yarn and pnpm, but not bun. ### How? - Add a separate Dockerfile.bun placed next to the existing Dockerfile, which is more sensible for the existing solution. - Dockerfile.bun uses the official oven/bun base image (different runtime/tooling than node:18-alpine), so a separate file should be clearer. - Existing Docker commands in the README remain unchanged, because Docker still uses the existing Dockerfile by default. - The bun example can be built with: `docker build -f Dockerfile.bun -t nextjs-docker .` Related to #78465, #82998 --------- Co-authored-by:
Joseph <joseph.chamochumbi@vercel.com> Co-authored-by:
vercel[bot] <35613825+vercel[bot]@users.noreply.github.com> Co-authored-by:
Joseph <sephxd1234@gmail.com>
-
Niklas Mischkulnig authored
This test is about `eval` But it also used a non-static middleware `matchers` config, which is going to break once we are more strict about this and throw a build error.
-
Hendrik Liebau authored
The sandboxes used in the `Error overlay for hydration errors in App router` test suite frequently lead to timeout errors in CI ([DD](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%40git.branch%3Acanary%20%40test.suite%3A%22Error%20overlay%20for%20hydration%20errors%20in%20App%20router%22&agg_m=count&agg_m_source=base&agg_t=count¤tTab=overview&eventStack=&fromUser=false&index=citest&start=1755633071704&end=1756929071704&paused=false)) and also make it unnecessarily complicated to run the scenarios locally with `pnpm next dev`. I also have a suspicion that the sandboxes are not properly cleaning up after themselves, leading to test interference. By saving the inlined layouts and pages to actual files, we can avoid the issues caused by sandboxes and make the tests faster, more reliable, and easier to debug.
-
Jiachi Liu authored
-
Benjamin Woodruff authored
This syntax was undocumented, and as far as I can tell, there are no OSS external users of this API: https://sourcegraph.com/search?q=context:global+/turbopack:%28.%7C%5Cn%29*conditions:/&patternType=keyword&sm=0 https://github.com/vercel/next.js/pull/82857 provides a better syntax for defining these conditions that we intend to document.
-
Luke Sandberg authored
This is leftover from when FileSystem operations were made synchronous
-
Tim Neutkens authored
## What? When using Turbopack we'd try to load these files even when they don't exist, which adds latency because of the retrying. This PR ensures the files are skipped from loading where possible, which moves the place where it starts loading the manifest to the route modules instead. The exception to this is the static generation steps as those don't rely on route modules yet. This is something still being worked on.
-
Sebastian "Sebbie" Silbermann authored
-
nextjs-bot authored
-
yiminghe authored
Co-authored-by:Jiachi Liu <inbox@huozhi.im>
-
Sebastian "Sebbie" Silbermann authored
-
Jiachi Liu authored
-
Jiachi Liu authored
-
Cong-Cong Pan authored
-
Hendrik Liebau authored
When a prerendered and deployed route handler is revalidated, we can not rely on having a cache handler that does in-memory caching. So we need to provide a prerender resume data cache (RDC) instead, to ensure that the revalidation doesn't fail with the following error: ``` Error: Dynamic server usage: Route / couldn't be rendered statically because it used IO that was not cached. ``` Route handlers are never resumed, so it's counter-intuitive to use an RDC for this scenario. However, we need the data cache to store cached results in memory during the prospective prerender, so that they can be retrieved during the final prerender within microtasks. In a follow-up, we should replace the `prerenderResumeDataCache` and `renderResumeDataCache` with a single `dataCache` property that is conceptually not tied to resuming, and also avoids the unnecessary complexity of using a mutable and an immutable resume data cache. closes NAR-350
-
Sebastian "Sebbie" Silbermann authored
-
Jiachi Liu authored
-
Joseph authored
Certain relative links were absolute, which renders them with the -> external arrow - might have been a decision per case, but AFAIK, this is only helpful for those links that are now redirecting to other content
-
Wyatt Johnson authored
## What? Fixed prerender info matching for rewritten paths in App Router by using `resolvedPathname` instead of `parsedUrl.pathname` in the app-page template. ## Why? Previously, the app-page template used `parsedUrl.pathname` to match against `prerenderManifest` routes. However, when middleware rewrites paths, `parsedUrl.pathname` contains the original (unrewritten) path, while `resolvedPathname` contains the actual path that should be used for prerender lookup. This mismatch caused incorrect prerender behavior for routes that were rewritten by middleware, as the handler would look up prerender info using the wrong path. This handling is special cased for when not handling an interception route when cache components is not enabled. This work is being tracked in NAR-335. ## How? - **Modified `packages/next/src/build/templates/app-page.ts`**: - Removed unused `parsedUrl` parameter from handler function - Updated prerender info matching to use `resolvedPathname` instead of `parsedUrl.pathname` - Added explanatory comment about why `resolvedPathname` is the correct choice - **Added comprehensive test suite** in `test/e2e/app-dir/sub-shell-generation-middleware/`: - Tests various middleware rewrite scenarios - Validates sub-shell generation behavior with nested dynamic routes - Tests both static and dynamic prerender scenarios - Includes middleware that rewrites paths to different route structures - **Enhanced deploy testing** in `test/lib/next-modes/next-deploy.ts`: - Added `stderr: 'inherit'` to provide earlier deployment feedback - Improves debugging experience for deployment-related tests The fix ensures that prerender info lookup works correctly for all paths, whether they're rewritten by middleware or not, providing consistent behavior across different routing scenarios. Fixes #83354
-
Sebastian "Sebbie" Silbermann authored
-
Luke Sandberg authored
## What #83074 migrated us to use `inventory` for registration, this obsoleted the build scripts and `register` functions. So, delete them! ## Why? Simplification, keeping registration and definition next to each other will make it easier to maintain. I was also optimistic about build performance. unscientifically i ran `cargo clean` and then timed `pnpm turbo build-native` with and without this PR (closed VSCode and other copies of rustc) CHANGE: real 3m30.220s user 34m41.703s sys 1m44.112s HEAD: real 3m31.017s user 34m47.691s sys 1m47.096s
😢 So yeah, not much of an effect, im guessing the build.rs scripts had good parallelism in the build or were just dwarfed by wasmer -
Jesse Hall authored
Upgraded to tailwind 4 and updated react version and dependencies. --------- Co-authored-by:
Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by:
Jiwon Choi <devjiwonchoi@gmail.com> Co-authored-by:
Michael Arguin <michael.arguin@vercel.com>
-
Luke Sandberg authored
## What? Leverage the `inventory` crate to automatically register turbo tasks objects using specialized linker sections. See https://docs.rs/inventory/0.3.21/inventory/ for details For NativeFunction and TraitType objects this was trivial and simplified the registry, for example. * functions only need the global registry during PC _deserialization_ so many builds can skip the cost. * Even when we do allocate it, we can use a normal `HashMap` instead of a `DashMap` which should be a minor performance benefit on its own (no locks, smaller in ram) * TraitType objects achieve similar benefits. The tricky part of course was trait impls: * Every `ValueType` needs to know all the trait methods it implements * To support calling `turbo_tasks::functions` on `Vc<Box<dyn T>>` * every `TraitType` needs to know all the structs that implement it * To support dereferencing a trait ref, aka `TraitRef<Box<dyn T>>` -> `&dyn T` to support calling non-turbotasks functions This required two more registries which more or less followed the existing pattern. One benefit of the new `inventory` approach is that the `VTableRegistry` drops its interior mutability (and associated locks). Constructing VTableRegistry objects also becomes lazy which is useful since many are not needed. So overall this should be equivalent but slightly better and it allows us to drop the build scripts (See #83156 ) One interesting note is determinism of `TraitTypeId` and `ValueTypeId`. Previously the values assigned were determined by the order of registrations in the build script. With inventory they are registered in an undefined order (im guessing it is deterministic based on linker input order, but inventory makes no guarantees). As far as i can tell, this does not matter, but in the interest of determinism i have sorted the values based on their names. In the future we can use this determinism to optimize persistence ## Why? By colocating registration with the proc macros we can simplify the registration logic. Switching to 'pull' based registration also simplifies a number of datastructures and allows us to drop some RWLocks ## Interesting consequences All the global type names are changing, dropping the `@TODO::` This `TODO` was a placeholder for a content hash of the current crate. This is to support a hypothetical idea where at least some of the persistent cache could survive turbopack updates. However based on team discussions we don't currently see a clear solution here. If we want to do this in the future i think we could still leverage hashes in names but we would need to compose them in a different way (e.g. `build.rs` script sets an `env` var that the proc macro reads with the `env!` macro)
-
Benjamin Woodruff authored
Turbopack: Implement `TaskInput` for `ReadRef`, use a `ReadRef` input for `AssetIdent::new` (#83356) @lukesandberg and I noticed this opportunity. ### Hypothesis `AssetIdent::new` is a dummy constructor function used for caching value with unique `Vc`s. It is called frequently. The `AssetIdent` struct is large and contains three different `Vec`s, so it's likely non-trivial to clone. - When an uncached turbo task function is called, its argument is boxed and cloned once to be used as cache key. There's two copies of the argument at this point: A cache key, and a local copy for the about-to-be-executed function. - This function immediately constructs a cell, which moves its local copy of the argument into a `triomphe::Arc`, preserving it. So we end up with two persistent copies of the task input. This doesn't matter when the struct is small and cheap to clone, but it does matter here. The solution is to wrap `AssetIdent` in a `ReadRef` before passing it to a `turbo_tasks::function`. `ReadRef` does not impact equality (defers to inner value), it's cheap to clone, and `ReadRef::cell` provides a fast-path that re-uses the inner `triomphe::Arc` for the newly constructed cell: https://github.com/vercel/next.js/blob/5cf762235a1e9f02443f45a69a7afd1880317f77/turbopack/crates/turbo-tasks/src/read_ref.rs#L247-L262 ### Tradeoffs If there's a cache hit, this approach constructs and throws away a temporary `Arc`, that the original implementation wouldn't. So in cases where there's a very high cache hit rate, or where the `Clone` would've been very cheap, this may come with a CPU time tradeoff. That doesn't seem to be the case here (cache hits are about 30%). ### Rough Benchmark Does not save a measurable amount of memory ``` cargo run --release -p next-build-test -- generate ~/shadcn-ui/apps/v4/ > ~/shadcn-ui/apps/v4/project_options.json cd ~/shadcn-ui/apps/v4/ pnpm i command time -v ~/next.js/target/release/next-build-test run sequential 1 1 '/sink' ``` maxrss (kbytes) before (5 runs): ``` 2355284 2325432 2320960 2281920 2385740 ``` maxrss (kbytes) after (5 runs): ``` 2361084 2323468 2364040 2353300 2388904 ``` This shows it's slightly worse, but only 1%, so it's easily within margin-of-error: <img src="https://app.graphite.dev/user-attachments/assets/a1a7e1c8-bc05-4262-91d8-c3590f5a1253.png" width=500>
-
- 02 Sep, 2025 15 commits
-
-
Vercel Release Bot authored
This auto-generated PR updates the development integration test manifest used when testing Rspack.
-
nextjs-bot authored
-
Joseph authored
Closes: https://linear.app/vercel/issue/DOC-5030/usesearchparams
-
Niklas Mischkulnig authored
Eventual consistency strikes again (?)
-
Hendrik Liebau authored
The HMR messages we send through the WebSocket to the browser were inconsistently called `message`, `msg`, `obj`, `payload`, or `action`. With this PR, we're streamlining the naming to consistently use `message` throughout the codebase. In addition, the discriminating property `action` is renamed to `type`, aligning it with Turbopack's own HMR messages. As an alternative, I considered naming them `action` instead, but this did not yield the desired consistency across the codebase. Ultimately, I decided to stick with `message` to avoid confusion and maintain alignment with Turbopack's terminology (see `@vercel/turbopack-ecmascript-runtime/browser/dev/hmr-client/hmr-client`).
-
Donny/강동윤 authored
### What? Pass the correct browserslist query to `lightningcss` in `styled-jsx`. ### Why? To fix an issue with `styled-jsx`. #### Testing instruction: 1. `git clone https://github.com/kdy1/repro-next-styled-jsx-526 ~/projects/repro-next-styled-jsx-526` 2. `pnpm pack-next -p ~/projects/repro-next-styled-jsx-526 && (cd repro-next-styled-jsx-526 && pnpm i && pnpm build && pnpm start` ### How? Closes https://github.com/swc-project/plugins/issues/526
-
Joseph authored
Let's try to change how we present useLinkStatus - it could be misused to overuse loading spinners next to links - which can cause layout shifts. Closes: https://linear.app/vercel/issue/DOC-5028/uselinkstatus-reformulation --------- Co-authored-by:
Ian Jones <witspr@gmail.com>
-
Steven authored
## Background We have default allowlists for the `url` (localPatterns/remotePatterns config) and `w` (imageSizes/deviceSizes config) but we don't have a default allowlist for `q` (currently opt-in with via qualities config). ## What's changing? BREAKING CHANGE: This PR is a breaking change that sets the default allowlist to `qualities: [75]`, meaning that anything other than 75 is invalid. Since most images don't set the quality prop and therefore default to 75, most apps will be unaffected. However, we can be even more gracious when users upgrade because we can coerce the value automatically to 75 (or rather any value in `qualities` allowlist). In dev, this will print a warning explaining why the prop was not observed. This also works if you had `qualities` configured but removed 75, since the closet matching value in the array will be used instead.
-
JUNAID ALI KHAN authored
This PR updates all example Dockerfiles that were using `node:18-alpine` to `node:20-alpine` to align with current LTS and address known issues in Node 18 images. - examples/with-docker/Dockerfile - examples/with-docker-compose/next-app/prod.Dockerfile - examples/with-docker-compose/next-app/dev.Dockerfile - examples/with-docker-multi-env/docker/development/Dockerfile - examples/with-docker-multi-env/docker/production/Dockerfile - examples/with-docker-multi-env/docker/staging/Dockerfile I verified local builds for each example. No behavior changes; docs/examples only. https://github.com/vercel/next.js/issues/78465 --------- Co-authored-by:
Joseph <joseph.chamochumbi@vercel.com>
-
Neko authored
### What? By following the default method to integrate OpenTelemetry in Next.js applications... this error occurs: ``` 'Resource' only refers to a type, but is being used as a value here. ``` ### Why? `Resource` presented here as a `interface` or type only definition, as specified in OpenTelemetry's repo, https://github.com/open-telemetry/opentelemetry-js/blob/2d544088ac9a4bcb07986be7d9cdc2d0688e7b44/packages/opentelemetry-resources/src/Resource.ts#L20-L30: > This interface is NOT user-implementable. Valid ways to obtain a {@link Resource} are by using either of these functions > - [`resourceFromAttributes`](https://github.com/open-telemetry/opentelemetry-js/blob/2d544088ac9a4bcb07986be7d9cdc2d0688e7b44/packages/opentelemetry-resources/src/ResourceImpl.ts#L149) > - [`emptyResource`](https://github.com/open-telemetry/opentelemetry-js/blob/2d544088ac9a4bcb07986be7d9cdc2d0688e7b44/packages/opentelemetry-resources/src/ResourceImpl.ts#L163) > - [`defaultResource`](https://github.com/open-telemetry/opentelemetry-js/blob/2d544088ac9a4bcb07986be7d9cdc2d0688e7b44/packages/opentelemetry-resources/src/ResourceImpl.ts#L167) > - [`detectResources`](https://github.com/open-telemetry/opentelemetry-js/blob/2d544088ac9a4bcb07986be7d9cdc2d0688e7b44/packages/opentelemetry-resources/src/detect-resources.ts#L27) ### How? By default, we use `resourceFromAttributes` for OTEL resources with attributes. Fixes: https://github.com/vercel/next.js/issues/77451Co-authored-by:
Joseph <joseph.chamochumbi@vercel.com>
-
우혁 authored
## For Maintainers ### What? Removed the references to the now-deleted examples guidelines from the PR template. Specifically, removed the line about ``` The "examples guidelines" are followed from our contributing doc https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md ``` since that file and folder were deleted in PR [#77050](https://github.com/vercel/next.js/pull/77050). ### Why? The `/examples` folder and its `adding-examples.md` file were removed, so the reference in the PR template to those guidelines is outdated and misleading. Keeping those references causes confusion for contributors by pointing to non-existent documentation. ### How? - Edited the PR template file. - Removed the outdated examples guidelines reference line. - Left other template content unchanged to preserve existing guidance. This ensures the PR template stays accurate, up-to-date, and helpful for contributors. --------- Co-authored-by:
Joseph <joseph.chamochumbi@vercel.com>
-
Joshua Hannaford authored
-
Hendrik Liebau authored
For unknown reasons, 3 of the 17 different HMR messages used an `event` property instead of `action`, leading to an unnecessarily convoluted handling of the HMR messages, where the `in` operator had to be used. > [!TIP] > Best reviewed with hidden whitespace changes.
-
Hendrik Liebau authored
[Flakiness metric](https://app.datadoghq.com/ci/test/runs?query=test_level%3Atest%20env%3Aci%20%40git.repository.id%3Agithub.com%2Fvercel%2Fnext.js%20%40test.service%3Anextjs%20%40test.status%3Afail%20%40test.name%3A%22app-dir%20-%20missing%20required%20html%20tags%20should%20hmr%20when%20you%20fix%20the%20error%22%20%40git.branch%3Acanary&agg_m=count&agg_m_source=base&agg_t=count&citest_explorer_sort=timestamp%2Cdesc&cols=%40test.status%2Ctimestamp%2C%40test.suite%2C%40test.name%2C%40duration%2C%40test.service%2C%40git.branch¤tTab=overview&eventStack=&fromUser=false&index=citest&start=1755509670941&end=1756805670941&paused=false) The test fixture already starts out with a missing tags error. This was not accounted for in the test, and could lead to the initial redbox being detected, instead of the one that appears after the layout was changed and the page was reloaded.
-
Remco Haszing authored
Co-authored-by:Sebastian "Sebbie" Silbermann <silbermann.sebastian@gmail.com>
-