- 23 May, 2024 3 commits
-
-
vercel-release-bot authored
-
JJ Kasper authored
## Background Previously we introduced automatic caching for `fetch` based on certain heuristics that were a bit tricky to grasp all scenarios. The scenarios we would automatically cache were no dynamic data access before the fetch call e.g. `headers()` or `cookies()`, the fetch call is inside of a dynamic page e.g. `POST` method or `export const revalidate = 0` page and the fetch is a non-`GET` request or has `Authorization` or `Cookie` headers, or the fetch had `cache: 'no-store' | 'no-cache'` or `revalidate: 0`. ## New Behavior By default fetches will no longer automatically be cached. Instead they need to be opted-in to caching via `export const fetchCache = 'default-cache' | 'force-cache',` `next: { revalidate: false or value > 0 }` or `cache: 'force-cache' | 'default-cache'`. When the fetch call is automatically skipping the cache it won't impact the page level ISR cacheability although if a fetch call manually specifies `cache: 'no-store'` or `revalidate: 0` it will still bail from the page being statically generated as it was before. To achieve the previous behavior of automatic fetch caching all that needs to be added is `export const fetchCache = 'default-cache'` in the root layout(s) of your project. -
Wyatt Johnson authored
When PPR is enabled, we should always write the prefetch RSC routes to ensure that the builder and FS cache can use it.
-
- 22 May, 2024 15 commits
-
-
vercel-release-bot authored
-
Janka Uryga authored
When hot-reloading an edge runtime page, sometimes we randomly get this: ``` [InvariantError: Invariant: Cannot call onClose on a response that is already sent. This is a bug in Next.js.] { name: 'InvariantError' } ``` and since `unstable_after` relies on `onClose`, no callbacks are called. I believe this is because `web-server` [calls `res.send()` pretty early for streaming responses](https://github.com/vercel/next.js/blob/b9817f83519fdaa7a7fcd4711dfb80aa1e1a2434/packages/next/src/server/web-server.ts#L311), so `res.sent` becomes `true` even though we're still streaming, and prevents us from calling `onClose` in the streaming render. It makes more sense to check the CloseController's `isClosed` instead -- when that becomes `true`, we _really_ shouldn't call onClose anymore (points to a bug), but before that it's fine. -
mknichel 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:
JJ Kasper <jj@jjsweb.site>
-
Sebastian Silbermann authored
-
JJ Kasper authored
Follow-up to https://github.com/vercel/next.js/pull/65825 this ensures we don't skip the static optimization specifically for metadata routes as this most often should be static as they aren't dynamic content and are requested very frequently.
-
Sebastian Silbermann authored
-
mknichel authored
This PR adds a flag to Next.js to enable Webpack options to improve memory usage. See https://github.com/webpack/webpack-sources/pull/155 for a full description of the changes and impact on memory. This PR adds a patch to `webpack-sources` temporarily that contains the fixes as the real changes are iterated on to merge upstream in the `webpack/webpack-sources` repository. After that is done, the patch will be reverted and the latest `webpack-sources` version will be updated in Next.js.
-
JJ Kasper authored
To avoid extra network hops we can compare existing cache entries we've already fetched and see if the revalidated value matches and if it does we can avoid sending the set request with the identical data.
-
Benjamin Woodruff authored
Use updated API suggested by sokra in review on #65223: https://github.com/vercel/next.js/pull/65223#discussion_r1587157258 Depends on https://github.com/vercel/turbo/pull/8075
-
Benjamin Woodruff authored
As noted in (https://github.com/vercel/nextpack/pull/103), by not having this as a default feature, when running the `build-native` script it's not able to re-use any cargo caches that might already exist from a default build. Because this feature impacts the swc crate, everything dependent on it can be forced to rebuild. By making this a default feature, the hope/theory is that the number of different ways we potentially build our dependency graph reduces, and cargo cache hits will improve. ## Changes - Add `plugin` to the default set of features for `next-swc-napi`. - Consolidate `build-native-no-plugin-woa` with `build-native-no-plugin`. Given the lack of any other default features, these are equivalent. - `i686-pc-windows-msvc`: Switch to `build-native-no-plugin-release` in CI instead of just supplying the `--release` flag. This has the benefit of also enabling `tracing/release_max_level_info`, which might reduce the size of or speed up these builds. - `x86_64-apple-darwin`: Remove a redundant `--release` flag in the CI config (no expected changes). ## Testing I've tested this locally on Linux (`pnpm run build-native`) and Windows-on-ARM (`pnpm run build-native-no-plugin`) by making sure things still build. I'll also make sure CI passes.
-
Steven authored
This parameter was previously used for a warning message, but we no longer print that warning since https://github.com/vercel/next.js/pull/63321 so now we can remove the unused parameter.
-
Zack Tanner authored
This implements an API to re-throw errors that are intended to be caught by Next.js, so that they are not caught by your code. RFC: https://github.com/vercel/next.js/discussions/64076 <!-- 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:
JJ Kasper <jj@jjsweb.site> Co-authored-by:
Ahmed Abdelbaset <A7med3bdulBaset@gmail.com> Co-authored-by:
Janka Uryga <lolzatu2@gmail.com>
-
Theo Todorov authored
Co-authored-by:Steven <steven@ceriously.com>
-
Sebastian Silbermann authored
-
JJ Kasper authored
Seems we weren't grabbing the latest cli output inside of `check` so if it wasn't ready by the time the first check successive checks wouldn't have it either. x-ref: https://github.com/vercel/next.js/actions/runs/9182806177/job/25253023758 x-ref: https://github.com/vercel/next.js/actions/runs/9182324607/job/25254072867
-
- 21 May, 2024 22 commits
-
-
vercel-release-bot authored
-
Will Binns-Smith authored
Previously with Turbopack, we would attempt to establish a websocket connection to the HMR server, even when running production builds. This adds `next-turbopack.ts`, which includes the necessary runtime code for Turbopack, but does not include HMR code. Test Plan: `TURBOPACK=1 TURBOPACK_BUILD=1 pnpm next build test/e2e/app-dir/app-middleware` --------- Co-authored-by:Tim Neutkens <tim@timneutkens.nl>
-
vercel-release-bot authored
-
Sebastian Silbermann authored
-
Zack Tanner authored
This configures the default client router cache `staleTime.dynamic` value to be `0`. This means that: - Navigating between pages will always fire off a network request to get RSC data for the page segment, rather than restoring from router cache - Loading states will remain cached for 5 minutes (or whatever `config.experimental.staleTimes.static` is set to) - Shared layout data will continue to remain cached due to [partial rendering](https://nextjs.org/docs/app/building-your-application/routing/linking-and-navigating#4-partial-rendering) - Back/forward behavior will still restore from cache to ensure the browser can restore scroll position. It's possible to opt-out of this, and into the previous behavior, by setting the [`staleTimes`](https://nextjs.org/docs/app/api-reference/next-config-js/staleTimes) config in `next.config.js`: ```js /** @type {import('next').NextConfig} */ const nextConfig = { experimental: { staleTimes: { dynamic: 30 }, }, } module.exports = nextConfig ``` <!-- 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 # -->
-
qqww08 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 # --> Hello This PR updates the `with-google-analytics` example to use: - App Router - TypeScript - @next/third-parties Co-authored-by:
Sam Ko <sam@vercel.com>
-
vercel-release-bot authored
-
Tim Neutkens authored
## What? Requires https://github.com/vercel/turbo/pull/8176 first. Grid scoping in CSS Modules is disabled because Webpack CSS Modules handling doesn't handle grid currently. This ensures moving from Webpack to Turbopack doesn't have mismatching behavior around CSS grid. Fixes #64509 Fixes #63758 Fixes PACK-2976 <!-- 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 # -->
-
OJ Kwon authored
### What this was the way we run ci on turbopack's repo and to get the latest test results, which isn't required anymore.
-
JJ Kasper authored
This reverts the below changes to avoid a breaking change in pages with importing `react-dom/server` as this is disallowed in `app` but shouldn't be in `pages`. Revert "Bundle the installed react for middleware (#65811)" Revert "Error in build for middleware when import client-only (#65792)" This reverts commit fdd8f0c6. This reverts commit 082072ca. x-ref: [slack thread](https://vercel.slack.com/archives/C03S8ED1DKM/p1716305493514869)
-
Will Binns-Smith authored
To sync with Turbopack. x-ref: vercel/turbo#8176
-
yasmin p authored
Updates the `create-next-app` template CSS to: - Prevent browsers (e.g. Safari) from using synthetic bold font weights - Move CSS variables out of global CSS / Tailwind config, to simplify the process of wiping the default template. <!-- 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:
JJ Kasper <jj@jjsweb.site>
-
JJ Kasper authored
Noticed while testing turbopack version of tests that we weren't loading the correct swc binary since this path wasn't absolute and was just the relative path in `node_modules`. --------- Co-authored-by:Zack Tanner <1939140+ztanner@users.noreply.github.com>
-
Vercel Release Bot authored
This auto-generated PR updates the development integration test manifest used when testing Turbopack.
-
Steven authored
Users no longer need to install `sharp` manually thanks to the following: - https://github.com/vercel/next.js/pull/63321
-
Janka Uryga authored
Since, https://github.com/vercel/next.js/pull/65830, I've been seeing weird flakes from `test/e2e/app-dir/app-invalid-revalidate/app-invalid-revalidate.test.ts`. ``` TIMED OUT: /Invalid revalidate value "1" on "\/", must be a non-negative number or "false"/ ``` The build output looks like this: ``` ▲ Next.js 14.3.0-canary.73 Creating an optimized production build ... [snip] Error: Invalid revalidate value "1" on "/_not-found", must be a non-negative number or "false" [snip] Generating static pages (2/4) > Build error occurred Error: Export encountered an error on /_not-found, exiting due to prerenderEarlyExit: true being set ``` Note that there's no `Invalid revalidate value "1"` message for `/`, so the test will fail. This looks like a race condition: the invalid `revalidate` value is set in a layout, so if `_not-found` happens to be prerendered before `/`, it'll abort the whole prerender (because of `prerenderEarlyExit: true`). so if the timing is right, the test -- which is looking for build errors for `/` -- will never see them and time out. There might be more of these, but unfortunately they're basically race conditions, so I think we'll have to squash them as they come up. CC @ijjk
-
Niaz Morshed Nayeem authored
-
Janka Uryga authored
We allow users in the Next.js team to push directly canary in order to allow emergency fixes (and, AFAIU, some other things in GH workflows). This PR adds a guardrail to prevent absentminded people from doing it by accident, requiring a 'git push --no-verify' to bypass the hook.
-
Janka Uryga authored
-
Sebastian Silbermann authored
Include the base commit in the generated changelog for React syncs.
-
Vercel Release Bot authored
This auto-generated PR updates the production integration test manifest used when testing Turbopack.
-
Lee Robinson authored
- Remove unnecessary `dynamic` route segment configs - Add version history - Remove caching opt-out section, since it's dynamic now --------- Co-authored-by:JJ Kasper <jj@jjsweb.site>
-