Commit Graph

3801 Commits

Author SHA1 Message Date
Tim Neutkens ec11c8622f docs: fix CSP example to only include unsafe-eval in development (#88407)
## What

Fixes the CSP documentation "Without Nonces" example to only include
`'unsafe-eval'` in development mode.

## Why

The example was showing `'unsafe-eval'` without a development check,
which would cause it to be shipped to production. This is inconsistent
with the guidance in the "Development vs Production Considerations"
section which correctly shows how to conditionally add `'unsafe-eval'`
only in development.

## How

Added a `isDev` check using `process.env.NODE_ENV === 'development'` and
conditionally includes `'unsafe-eval'` in the `script-src` directive
only when in development mode.
2026-01-12 10:13:16 +01:00
Zack Tanner 0d4649989d next/image: support custom cache handlers (#88248)
When self-hosting Next.js, it's possible to customize a cache handler
for ISR. Self-hosted Next.js also makes use of a similar cache interface
for `next/image`, but there's no way to customize this cache handler.

This plugs into the [existing
ability](https://nextjs.org/docs/app/api-reference/config/next-config-js/incrementalCacheHandlerPath)
to customize a `cacheHandler` to support the `IMAGE` type. This lets you
implement whatever constraints you might have on your self-hosted
environment, eg the need for an LRU cache, or storing optimized images
outside of disk.

This is currently opt-in because it's a breaking change for cache
handlers to start receiving `IMAGE` cache types, which we'll make
default in the next major.
2026-01-08 10:58:49 -08:00
Jimmy Lai fd5817d004 feat: add --experimental-cpu-prof flag for dev, build, and start (#87946)
## What

Adds a `--experimental-cpu-prof` flag to `next dev`, `next build`, and
`next start` commands to capture V8 CPU profiles for debugging
performance bottlenecks.

## Why

When investigating slow builds, slow dev server startups, or production
server performance issues, having access to CPU profiles is invaluable.
This provides a first-party way to capture these profiles without
needing to manually set up the V8 inspector.

## How

- Adds `--experimental-cpu-prof` flag to CLI commands
- Uses V8's built-in CPU profiler via Node.js inspector module
- Profiles are saved to `.next/cpu-profiles/` with descriptive filenames
- Profiles are saved on process exit (Ctrl+C, SIGTERM, or normal exit)

### Profile files generated

**`next dev`:**
- `dev-main-*` - Parent process (dev server orchestration)
- `dev-server-*` - Child server process (request handling and rendering)

**`next build` (Turbopack):**
- `build-main-*` - Main build orchestration process
- `build-turbopack-*` - Turbopack compilation worker

**`next build` (Webpack):**
- `build-main-*` - Main build orchestration process
- `build-webpack-client-*` - Client bundle compilation worker
- `build-webpack-server-*` - Server bundle compilation worker
- `build-webpack-edge-server-*` - Edge runtime compilation worker

**`next start`:**
- `start-main-*` - Production server process

## Changes addressing PR review comments

- Removed signal handlers from `cpu-profile.ts` to prevent conflicts
with CLI cleanup logic (telemetry, traces, etc.)
- Added synchronous exit handler for non-signal process exits (errors,
`process.exit()` calls)
- CLI commands now explicitly call `saveCpuProfile()` as part of their
cleanup before exiting
- Replaced raw ANSI escape codes with `picocolors` library
- Added comprehensive documentation about profile file naming for each
command
- Added build profiling test that verifies correct profile generation
for both Turbopack and Webpack modes

---------

Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
2026-01-07 11:24:41 +01:00
Tim Neutkens ae17e48bbf Update generateMetadata in client component error (#88172)
## What?

Improves the error shown when `generateMetadata` or `metadata` is
exported from a Client Component.

Also updated the documentation to further explain why it can only be
used in a server component and the steps to follow to resolve the error.
2026-01-07 09:45:44 +01:00
Steven 00e92280d2 feat(next/image)!: add images.maximumResponseBody config (#88183)
Add `images.maximumResponseBody` configuration to exit early when
attempting to optimize large source images.
2026-01-06 14:49:45 -08:00
Jiachi Liu fe34ade9b5 [docs] add get_routes in mcp available tools (#88181) 2026-01-06 21:02:10 +00:00
Joseph 9b44e2f2ee docs: fix typos and clarify examples in Cache Components guide (#87530) 2025-12-20 17:11:01 -05:00
Joseph a350c2bca5 docs: tweaks/fixes to papercuts (#87445) 2025-12-20 13:09:21 -08:00
Joseph ac4f404c97 docs: generateMetadata and generateViewport w/ CC (#87218)
Co-authored-by: Rich Haines <hello@richardhaines.dev>
2025-12-19 18:05:06 +01:00
Delba de Oliveira bfeedb070a Guide: Update Optimizing Package Bundling to include new Bundle Analyzer (#87246)
This PR adds instructions on how to run and navigate the new turbopack
bundle analyzer to the existing [Optimizing package bundling guide
](https://nextjs.org/docs/app/guides/package-bundling).
Todo: 
- [x] Embed video
- [x] Add image for import chain

---------

Co-authored-by: Luke Sandberg <lukesandberg@users.noreply.github.com>
Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
Co-authored-by: Joseph <joseph.chamochumbi@vercel.com>
Co-authored-by: Rich Haines <hello@richardhaines.dev>
Co-authored-by: vercel[bot] <35613825+vercel[bot]@users.noreply.github.com>
2025-12-19 16:21:14 +00:00
Eng Zer Jun c02a04d974 docs: fix highlight in 05-server-and-client-components.mdx (#87347)
In the **When to use Server and Client Components?** section of [Server
and Client
Components](https://nextjs.org/docs/app/getting-started/server-and-client-components)
page, the code block should highlight line 17 `<LikeButton
likes={post.likes} />` to demonstrate that it is passing a prop to the
component.


![](https://github.com/user-attachments/assets/c32ba20b-7a52-4855-807a-ea3930c7032b)

---------

Co-authored-by: Joseph <sephxd1234@gmail.com>
Co-authored-by: Joseph <joseph.chamochumbi@vercel.com>
2025-12-19 13:56:28 +01:00
Joseph b1b59346c3 docs: use cache private redo (#87111) 2025-12-18 21:43:23 +01:00
Joseph f6df65cb11 docs: next experimental-analyze (#87272)
Adding CLI docs for next experimental-analyze

---------

Co-authored-by: vercel[bot] <35613825+vercel[bot]@users.noreply.github.com>
2025-12-18 21:41:14 +01:00
Roel Vaneyghen aaee236cb5 Update self-hosting.mdx (#87109)
small typo fix

Co-authored-by: Joseph <joseph.chamochumbi@vercel.com>
2025-12-12 17:23:09 +01:00
Joseph 6cc51a3b8a docs: dynamic routes w/ gsP (#86402) 2025-12-12 14:51:29 +01:00
Joseph 916f45d5e5 docs: use cache remote (#86546) 2025-12-11 12:15:49 +01:00
Viraj Jadhav 593cef1b97 docs: remove deprecated url.parse() from custom server example (#86986)
This PR updates the custom server documentation to remove usage of
Node's
deprecated `url.parse()` API. The example does not require URL parsing,
since
the `parsedUrl` argument is optional for the Next.js `RequestHandler`.

Removing `url.parse()` avoids Node deprecation warnings (DEP0116,
DEP0169) and
keeps the example aligned with current best practices.

### What changed?
- Removed the `url.parse()` import and usage.
- Removed unused `parsedUrl` variable.
- Updated both TS and JS examples to use `handle(req, res)` directly.

### Why?
- `url.parse()` is deprecated in modern Node versions.
- The example works without URL parsing.
- Simplifies the docs and matches recommended APIs.

Fixes #86951 and https://github.com/vercel/next.js/issues/83183

Co-authored-by: Joseph <joseph.chamochumbi@vercel.com>
2025-12-10 14:58:36 +01:00
Joseph 42690262d6 docs: codemode upgrade command (#87006) 2025-12-10 09:47:04 +01:00
Joseph 22caab8676 docs: improve TypeScript navigation/discoverability (#86938)
Add signposts and info about next-env.d.ts. Also rework links from
getting started to TypeScript features, and from the to config
reference.
2025-12-09 21:35:19 +01:00
Joseph b90b3034e4 docs: i18n type narrowing w/ runtime guards (#86871)
Closes: https://github.com/vercel/next.js/issues/86864
2025-12-09 21:23:25 +01:00
Joseph 347c8dfaaf docs: use cache debugging notes (#86937)
Closes: https://github.com/vercel/next.js/issues/86896
2025-12-09 21:22:51 +01:00
Joseph 73f5076257 docs: fix generateSitemaps returned type signature (#86984)
Closes: https://github.com/vercel/next.js/issues/86959
2025-12-09 13:01:22 +01:00
muhammad syaddad 19421c3792 docs: fix broken examples link (#86916)
### What?
Fix broken link in the documentation pointing to the examples folder.

### Why?
The previous link to the examples folder in
`docs/04-community/index.mdx` was incorrect:
https://github.com/vercel/next.js/tree/canary/contributing/examples
This caused confusion and 404 errors for contributors trying to access
the correct examples.
(the url page is in here
https://nextjs.org/docs/community/contribution-guide)
### How?
Updated the link in `docs/04-community/index.mdx` to point to the
correct folder:
from 
https://github.com/vercel/next.js/tree/canary/contributing/examples
to
https://github.com/vercel/next.js/tree/canary/examples

Co-authored-by: Joseph <joseph.chamochumbi@vercel.com>
2025-12-08 22:12:13 +01:00
Joseph 78660a5386 Add gitignore note for next-env.d.ts (#86809)
<!-- 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

- [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-guide

### What?
Adds a note to the `next-env.d.ts` entry in the project structure
documentation.

### Why?
To clarify that `next-env.d.ts` is a generated file and should be
excluded from version control (i.e., added to `.gitignore`). This helps
developers follow best practices for Next.js project setup.

### How?
Updated `docs/01-app/01-getting-started/02-project-structure.mdx` to add
"(should not be tracked by version control)" to the description of
`next-env.d.ts`.

Closes NEXT-
Fixes #

-->

---
[Slack
Thread](https://vercel.slack.com/archives/C07BS1WEYAZ/p1764841040993409?thread_ts=1764841040.993409&cid=C07BS1WEYAZ)

<a
href="https://cursor.com/background-agent?bcId=bc-fc2eab83-628d-4ae1-b190-436d7e00063e"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://cursor.com/open-in-cursor-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://cursor.com/open-in-cursor-light.svg"><img alt="Open in
Cursor"
src="https://cursor.com/open-in-cursor.svg"></picture></a>&nbsp;<a
href="https://cursor.com/agents?id=bc-fc2eab83-628d-4ae1-b190-436d7e00063e"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://cursor.com/open-in-web-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://cursor.com/open-in-web-light.svg"><img alt="Open in Web"
src="https://cursor.com/open-in-web.svg"></picture></a>

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
2025-12-08 11:36:09 +01:00
Niklas Mischkulnig 3bb0bcbf82 Add pino-related packages to server-external-packages (#86884) 2025-12-05 22:53:56 +01:00
Jeff 38ef2360e1 Add Firebase App Hosting to the deployment guide (#86832)
Add Firebase App Hosting to the list of adapters in the [deployment
guide](https://nextjs.org/docs/app/getting-started/deploying#adapters).

<!-- 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 #

-->

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2025-12-04 19:06:04 +00:00
dan 3afc77738a Remove Vercel mention from Next.js docs (#86801)
I think overall it's not appropriate to add Vercel-specific caveats to
these guides because they make it look like they're upselling Vercel.
I've edited to emphasize the self-hosting condition instead, from which
one should be able to infer it doesn't apply to Vercel.

Co-authored-by: Joseph <joseph.chamochumbi@vercel.com>
2025-12-04 14:23:57 +00:00
Joseph 80791c019f docs: cookie clear and has alignment (#86788)
Closes: https://github.com/vercel/next.js/issues/86778
2025-12-04 10:33:29 +01:00
danpeleg4 654cd8e431 Fix typo in fetching data documentation (#86758)
Corrects a grammatical error in the data preloading explanation. The
phrase "an utility function" was updated to "a utility function" because
"utility" begins with a consonant sound. This improves clarity and
maintains consistency with standard English usage throughout the
documentation.
2025-12-03 13:27:49 +00:00
Luke Sandberg 50d459e688 [turbopack] Remove the docs on the bundle size gap (#86707)
The biggest gap was 'Inner graph treeshaking' which was implemented in #85973 as `remove_unused_imports`

So we no longer need to document this issue
2025-12-02 00:52:56 -08:00
Luke Sandberg de57f78924 [turbopack] Enable filesystem cache by default for development (#85975)
Enable Turbopack filesystem cache for dev by default

Remove the canary block on the option for builds, but that remains false by default
2025-12-01 15:48:09 -08:00
マルコメ 2307d46f51 docs: update prefix two-digit number in routing section (#77758)
## Description

The current [routing
documents](https://github.com/vercel/next.js/tree/canary/docs/01-app/03-building-your-application/01-routing)
are missing `01` and `02` prefix.

This PR changes the numbering of them and update [contribution-guide
docs](https://github.com/vercel/next.js/blob/canary/docs/04-community/01-contribution-guide.mdx).

### 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-guide

<!-- 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

Co-authored-by: Joseph <joseph.chamochumbi@vercel.com>
2025-12-01 11:46:38 +01:00
Yiming Cao 4a8eeab2fc Add "@zenstackhq/runtime" to server-external-packages.json (#54829)
### What?

[ZenStack](https://github.com/zenstackhq/zenstack) is a toolkit built
above Prisma ORM for adding access control and other features. This
change adds one of its packages "@zenstackhq/runtime" to the default
list of "serverComponentsExternalPackages".

### Why?

The package is frequently used in Next.js route handlers and results in
false-positive errors with Next.js's bundler (likely caused by
dynamically `require` modules).

### How?

Add the package to the default external packages list.

---------

Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
2025-11-28 12:37:43 +01:00
Ben b43fe3542b Add alinea to server-external-packages.json (#55006)
### What?

Adds `@alinea/generated` to the external package list

### Why?

[`Alinea`](https://github.com/alineacms/alinea) generates this package
at build time and it should not end up in a cache (much like the
`@prisma/client` package)

---------

Co-authored-by: JJ Kasper <jj@jjsweb.site>
Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
2025-11-27 17:28:00 +01:00
Allen Zhou d96cc5c5d4 docs: fix cache component doc grammar (#86563)
<!-- 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 #

-->

Fixes grammar error in cache components doc

Co-authored-by: Joseph <joseph.chamochumbi@vercel.com>
2025-11-27 10:33:34 +01:00
Joseph 6bfd81847f Fix grammar and typos in typescript doc (#86513)
<!-- 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

- [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-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?
Fixes grammar and typos in the TypeScript configuration documentation.

### Why?
To improve the clarity and correctness of the documentation.

### How?
- Removed an unnecessary article ("the") on line 38.
- Corrected a preposition ("on" to "in") on line 128.
- Fixed subject-verb agreement ("need" to "needs") on line 158.

Closes NEXT-
Fixes #

-->

---
[Slack
Thread](https://vercel.slack.com/archives/C07BS1WEYAZ/p1764105619569089?thread_ts=1764105619.569089&cid=C07BS1WEYAZ)

<a
href="https://cursor.com/background-agent?bcId=bc-732fcdec-b21b-4ce1-9c26-b10386636edc"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://cursor.com/open-in-cursor-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://cursor.com/open-in-cursor-light.svg"><img alt="Open in
Cursor"
src="https://cursor.com/open-in-cursor.svg"></picture></a>&nbsp;<a
href="https://cursor.com/agents?id=bc-732fcdec-b21b-4ce1-9c26-b10386636edc"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://cursor.com/open-in-web-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://cursor.com/open-in-web-light.svg"><img alt="Open in Web"
src="https://cursor.com/open-in-web.svg"></picture></a>

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
2025-11-25 23:02:47 +01:00
Muhammed Al-Dulaimi 88d774f9b5 docs: fix getInitialProps execution behavior during navigation (#86387)
Closes https://github.com/vercel/next.js/issues/86386

<!-- 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 #

-->

---------

Co-authored-by: Joseph <sephxd1234@gmail.com>
Co-authored-by: Joseph <joseph.chamochumbi@vercel.com>
2025-11-24 12:58:42 +00:00
Jimmy Lai 8c271102dd Update Next.js auth docs examples (#86361)
<!-- 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?
Updated the `Layouts and auth checks` section in the authentication
documentation (`docs/01-app/02-guides/authentication.mdx`).

### Why?
The previous example demonstrating authentication checks within layouts
was confusing and contradicted the documentation's own advice against
this pattern. This update aims to provide clearer, recommended
approaches for implementing authentication checks.

### How?
- Removed the misleading layout-based authentication example.
- Introduced a new subsection with an example showing authentication
checks in a page component.
- Added another new subsection with an example demonstrating
authentication checks in a leaf component.
- Enhanced the "Good to know" section with a reminder about the
necessity of authorization checks for Server Actions.

Closes NEXT-
Fixes #

-->

---
[Slack
Thread](https://vercel.slack.com/archives/C03KAR5DCKC/p1763685748449029?thread_ts=1763685748.449029&cid=C03KAR5DCKC)

<a
href="https://cursor.com/background-agent?bcId=bc-f490a8eb-8f55-4a85-a31a-357adb24c09a"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://cursor.com/open-in-cursor-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://cursor.com/open-in-cursor-light.svg"><img alt="Open in
Cursor"
src="https://cursor.com/open-in-cursor.svg"></picture></a>&nbsp;<a
href="https://cursor.com/agents?id=bc-f490a8eb-8f55-4a85-a31a-357adb24c09a"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://cursor.com/open-in-web-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://cursor.com/open-in-web-light.svg"><img alt="Open in Web"
src="https://cursor.com/open-in-web.svg"></picture></a>

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
2025-11-21 15:31:48 -08:00
Joseph 22cc5be063 docs: cacheLife feedback (#86128)
- Adjust nested behavior
- Include conditional calls to cacheLife

---------

Co-authored-by: Ismael <ismael@vercel.com>
2025-11-21 21:27:44 +01:00
Niklas Mischkulnig 10e0828fb9 Use JSONC for default server-external-packages (#86252)
So that we can then use comments to track a reason why we have added packages to this list.
2025-11-21 11:45:39 +01:00
Joseph e31608f15f docs: serverless deploy feedback (#86357)
Co-authored-by: Rich Haines <hello@richardhaines.dev>
2025-11-21 11:11:58 +01:00
Kazi Mahbubur Rahman 1dd580dad8 docs: add example for enabling both AVIF and WebP image formats for better image optimization (#86191)
## Title
docs: add example for enabling both AVIF and WebP image formats

## Description

### What?
This PR enhances the image component documentation by adding examples
showing how to enable both AVIF and WebP image formats together in
`next.config.js`. It also updates the `image-component` example to
demonstrate this configuration.

### Why?
Currently, the documentation only shows examples for:
- WebP only (default): `formats: ['image/webp']`
- AVIF only: `formats: ['image/avif']`

However, many developers want to enable both formats together to:
- Prefer AVIF for browsers that support it (better compression, ~20%
smaller files)
- Fall back to WebP for broader browser compatibility
- Maximize image optimization across different browsers

This configuration is a best practice but wasn't clearly documented with
an example.

### How?
- Added example configuration `formats: ['image/avif', 'image/webp']` to
App Router image component documentation
- Added the same example to Pages Router (legacy) image component
documentation for consistency
- Updated `examples/image-component/next.config.js` to demonstrate the
configuration
- Added clarification that the order matters - Next.js uses the first
format in the array that the browser supports

### Changes Made
- `docs/01-app/03-api-reference/02-components/image.mdx` - Added AVIF +
WebP example
- `docs/02-pages/04-api-reference/01-components/image-legacy.mdx` -
Added AVIF + WebP example
- `examples/image-component/next.config.js` - Added formats
configuration

### Testing
- [x] Documentation changes only - no code changes
- [x] Verified examples are syntactically correct
- [x] Checked that formatting follows Next.js documentation guidelines

### Checklist
- [x] Run `pnpm prettier-fix` to fix formatting issues (if applicable)
- [x] Documentation follows the docs guidelines
- [x] Changes are clear and helpful for developers

---------

Co-authored-by: Joseph <joseph.chamochumbi@vercel.com>
2025-11-20 23:27:07 +01:00
Joseph fedee7d7c4 docs: follow up to getting started CC and use-cache API ref (#85582)
Expanding on the Getting started for CC and also extending `use cache`

---------

Co-authored-by: Delba de Oliveira <32464864+delbaoliveira@users.noreply.github.com>
2025-11-18 13:50:15 +01:00
Jonathan Ho d174698cde docs: cacheHandlers use object instead of class (#86022)
<!-- 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 #

-->

This PR fixes the docs' example where it used class (like cacheHandler
(no s)), but cacheHandlers expect an object.

---------

Co-authored-by: Joseph <joseph.chamochumbi@vercel.com>
2025-11-18 11:33:39 +00:00
Sebastian "Sebbie" Silbermann 1587978363 [next-upgrade] Add next upgrade (#86120) 2025-11-18 11:53:26 +01:00
Joseph a63f15969c chore: remove empty docs folder (#86216) 2025-11-18 09:29:06 +01:00
jokokoloko 9c416ee2fd Update 14-metadata-and-og-images.mdx (#86198)
Changed better match example images and to be consistent within
documentation copy.

<!-- 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 #

-->

Co-authored-by: Joseph <joseph.chamochumbi@vercel.com>
2025-11-17 15:09:49 +01:00
Hamidreza Nateghi d1643b47c4 Fix typo on 03-layouts-and-pages.mdx (#86186)
<!-- 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 #

-->

Co-authored-by: Joseph <joseph.chamochumbi@vercel.com>
2025-11-17 15:09:40 +01:00
Bernd Strehl 9dc96c89e5 Remove redundant example code for cacheLife docs (#86043)
Remove redundant example code for overriding cache profiles.

## For Contributors

### Improving Documentation

- Run `pnpm prettier-fix` to fix formatting issues before opening the
PR. ✅ (no changes)
- Read the Docs Contribution Guide to ensure your contribution follows
the docs guidelines:
https://nextjs.org/docs/community/contribution-guide ✅

### What?

Remove a redundant example in the `cacheLife` docs.

### Why?

Because the redundant example is confusing.

### How?

Closes NEXT-
Fixes #

-->
2025-11-13 20:39:08 +00:00
sequencerr ef051ff3dc Update cookies.mdx (#86094)
delete is reserved word

<!-- 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 #

-->

Co-authored-by: Joseph <joseph.chamochumbi@vercel.com>
2025-11-13 20:20:14 +00:00