Commit Graph

1072 Commits

Author SHA1 Message Date
Kaung Min Khant 95ee107a85 Update caching.mdx (#83149)
In the docs it says => ( The default caching behavior of fetch (e.g.,
when the cache option is not specified) is equal to setting the cache
option to no-store )

But when I code, I found that fetch default behaviour and setting the
cache option to no-store are different.

After building process ....

When changing routes. default is stored as cache. I see that because
there is no new network request when I change route. In setting the
cache option to no-store, it is making a new network request as soon as
i get back to the page.

so docs and real working one are mismatch.

I also provided how tested with pictures belows.
Please build... and check
Change routes...

<img width="545" height="371" alt="image"
src="https://github.com/user-attachments/assets/4931302f-b5ef-4016-b43d-cbbd790c1e11"
/>

<img width="601" height="409" alt="image"
src="https://github.com/user-attachments/assets/3f2b4a79-fa24-466f-8330-0dc8323b6c16"
/>

Fixes https://github.com/vercel/next.js/issues/83146

---------

Co-authored-by: Joseph <joseph.chamochumbi@vercel.com>
2025-09-01 10:38:14 +02:00
Joseph a26a753fa4 docs: fix snippets in getting started (#83228)
Fixing snippets in Getting Started
2025-08-30 00:38:05 +02:00
Joseph 3f122a4a51 Docs/typed routes snippets (#83132)
A few more improvements to typed routes and friends

- showing usage of router methods from `next/navigation` 
- using Route in other data structures
2025-08-28 14:55:15 +02:00
Lorenzo Palmes 90c0dcec0b Update middleware node version history with latest stable release (#83166)
<!-- 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 #

-->

Updates the middleware version history marking node as stable as
[announced in version
15.5](https://nextjs.org/blog/next-15-5#nodejs-middleware-stable)

Co-authored-by: Joseph <joseph.chamochumbi@vercel.com>
2025-08-28 13:52:12 +02:00
HosamSenosi 1a5ef158f0 Added 2 values to the props table at 02-components/image.mdx (#83160)
Added `unoptimized` and `decoding` props to the props table (the table
at the top of the doc page).

I was looking for the `unoptimized` prop and thought it wasn't in this
page because I could not find it at the props table. I think it's better
included there since it's not deprecated. The same goes for `decoding`.

Added them with the same syntax as the rest values in the table. 

Thanks.

Co-authored-by: Joseph <joseph.chamochumbi@vercel.com>
2025-08-28 13:52:06 +02:00
Jiwon Choi 5f768fe422 [Breaking] remove deprecated devIndicators options (#83124)
This PR removed deprecated `devIndicators` options since v15.2.0.
2025-08-28 00:28:33 +02:00
Joseph 70e5f22572 docs: Expanded type checks to Pages Router and tsconfigPath (#83096)
Closes:
https://linear.app/vercel/issue/DOC-5027/tsconfigpath-and-typed-routes-updates

Also addresses: https://github.com/vercel/next.js/issues/83109
2025-08-27 22:31:19 +02:00
ryu 43d4532a32 docs: clarify the location of middleware.ts (#83056)
<!-- 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 #

-->

I think the phrase "in the root of your project" is unclear and
contradictory if we use `src` directory.

https://nextjs.org/docs/app/api-reference/file-conventions/src-folder#:~:text=src/app%20or%20src/pages%20will%20be%20ignored%20if%20app%20or%20pages%20are%20present%20in%20the%20root%20directory.

So This PR removes that phrase.

---------

Co-authored-by: Joseph <sephxd1234@gmail.com>
Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
Co-authored-by: Joseph <joseph.chamochumbi@vercel.com>
2025-08-27 10:13:06 +02:00
Joseph 71d1e9728d docs: next lint post 15.5 release adjustments (#82933)
Update installation guide, now we have Biome as an option to
create-next-app, and next lint is deprecated.

Also addresses: https://github.com/vercel/next.js/issues/82916

---------

Co-authored-by: vercel[bot] <35613825+vercel[bot]@users.noreply.github.com>
Co-authored-by: Ben Gubler <nebrelbug@gmail.com>
2025-08-27 00:33:00 +02:00
Hendrik Liebau 4b66771895 Remove deprecated legacyBehavior and passHref prop from Link component (#83003)
The `legacyBehavior` prop of the `Link` component has been deprecated
since #77473. For Next.js 16, we're finally removing support for it.
Consequently, we're also removing support for the `passHref` prop, which
was only useful in conjunction with the `legacyBehavior` prop.

A [codemod is
available](https://nextjs.org/docs/app/guides/upgrading/codemods#new-link)
to help you automatically upgrade your codebase.

reverts #77473

---------

Co-authored-by: Sebastian Sebbie Silbermann <sebastian.silbermann@vercel.com>
2025-08-26 14:04:27 +02:00
Joseph b4319bc8a4 Docs/late aug feedback (#82953)
- I've seen `NextResponse.next({ headers });` where devs likely meant
`NextResponse.next({ request: { headers } });`
  - for example https://github.com/vercel/next.js/issues/82937
- Explaining further `outputFileTracingIncludes-*` options

---------

Co-authored-by: vercel[bot] <35613825+vercel[bot]@users.noreply.github.com>
2025-08-26 12:57:22 +02:00
Joseph 6f1f49ebbe docs: typed routes manual tsconfig includes (#83031)
Docs fix to: https://github.com/vercel/next.js/issues/83010
2025-08-26 12:46:27 +02:00
Joseph 516b28270e Docs/getting started improv (#82741)
Part of:
https://linear.app/vercel/issue/DOC-4809/layout-pages-and-linking-and-navigating-improvements

Iterating a bunch of improvements to getting-started
2025-08-26 12:37:49 +02:00
Akinjide 1029d059a8 Update 07-fetching-data.mdx (#82862)
Promise.all or any of the other 3 static concurrency methods don't
actually run requests in parallel, rather they execute concurrently.

[Parallelism vs
Concurrency](https://wiki.haskell.org/Parallelism_vs._Concurrency)
[Promise
Concurrency](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise#promise_concurrency)

<!-- 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?
[Concurrency was confused as
parallelism](https://wiki.haskell.org/Parallelism_vs._Concurrency)
### Why?
Might confuse others, especially those still learning on how promises
work.
### How?
Promise.all or any of the other 3 static concurrency methods don't
actually run requests in parallel, rather they execute
[concurrently](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise#promise_concurrency).
Closes NEXT-
Fixes #

-->

---------

Co-authored-by: vercel[bot] <35613825+vercel[bot]@users.noreply.github.com>
Co-authored-by: Joseph <sephxd1234@gmail.com>
Co-authored-by: Joseph <joseph.chamochumbi@vercel.com>
2025-08-25 13:12:22 +02:00
P41T 8e8dd0c8c2 Update prettier project dependency from 3.2.5 to 3.6.2 (#82896)
What?
This PR updates the dependency "prettier" from version 3.2.5 to version
3.6.2. It also modifies other scripts by using the pnpm run prettier-fix
after updating the dependency.

Why?
This is updated to benefit from the changes and fixes introduced in the
newer versions of prettier, from versions 3.3 to 3.6.

How?
The package has been updated using pnpm install prettier@latest, and the
files other than package.json and pnpm-lock.json have been modified
using the script pnpm run prettier-fix.

This PR does only have formatting changes introduced by the updated
dependency
This PR is the same as #82719 , with fixes implemented to prevent
prettier to modifiy symlink files
2025-08-21 21:05:20 +00:00
Nicolas Charpentier bed08dd1cc docs: fix typo in Image#priority (#82806)
`s/isused/is used`

<!-- 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>
2025-08-20 01:11:34 +00:00
Will Binns-Smith 58d85ae99c docs: mention turbopack config codemod (#82183) 2025-08-19 17:53:21 -07:00
Ben Gubler 77bb702a01 docs: add explanation of disabling lint for next build (#82805)
Co-authored-by: Zack Tanner <1939140+ztanner@users.noreply.github.com>
2025-08-19 23:27:19 +00:00
Joseph 533bcd1485 docs: Route props helpers, typegen and next lint deprecation (#82784)
As this lands and people learn about the new Route Props helpers, I
think we will have this period where the TypeScript snippets show the
manual typing, but in key places we introduce the helpers usage. We can
then follow up updating all TypeScript snippets showing a page, layout
or route, to use these.

---------

Co-authored-by: Ben Gubler <nebrelbug@gmail.com>
Co-authored-by: JJ Kasper <jj@jjsweb.site>
2025-08-19 14:32:52 -07:00
Madhur Mittal e6718d699d docs: fix TS error in Node.js runtime local assets example (#82672)
## What?  
Updated the documentation for `opengraph-image` / `twitter-image` to fix
the **Node.js runtime with local assets** example.

## Why?  
The existing snippet did not type-check cleanly with Next.js 15+ and
could confuse developers.
This update improves developer experience by ensuring the snippet is
immediately usable and accurate.

## How?  
- Reproduced the example in a fresh Next.js 15+ project.  
- Updated the docs example to:  
  - Use `readFile` + Base64 encoding instead of invalid file URLs.  
  - Clarify that assets should be placed relative to the project root.  
- Added an entry to **Version History** noting the update in v15.x.  

## Checklist  
- [x] Ran `pnpm prettier-fix`  
- [x] Verified formatting & linting (`pnpm build && pnpm lint`)  
- [x] Documentation guidelines followed  
- [x] Example verified in a real Next.js 15 project  

Fixes #75583 & #75625 (if considered same class of issue)

---------

Co-authored-by: Joseph <sephxd1234@gmail.com>
Co-authored-by: Joseph <joseph.chamochumbi@vercel.com>
2025-08-19 21:28:18 +00:00
Ben Gubler 91da00336c fix: remove a few old references to 'next lint' (#82800) 2025-08-19 20:56:46 +00:00
Ben Gubler c57fe2561c feat: add a codemod to migrate from the deprecated "next lint" command (#82685)
## Add codemod to migrate from `next lint` to ESLint CLI

This PR introduces a new codemod `next-lint-to-eslint-cli` that helps
users migrate away from the deprecated `next lint` command to using
ESLint directly, in preparation for Next.js 16 where `next lint` will be
removed.

### What it does

The codemod automates the migration process by:

1. **Updating package.json scripts** - Replaces all `next lint` commands
with `eslint` equivalents
- Maps Next.js-specific flags (`--strict` → `--max-warnings 0`,
`--dir`/`--file` → paths)
   - Preserves other ESLint-compatible flags
- Handles complex scripts with pipes, redirects, and multiple commands

2. **Managing ESLint configuration**
   - Creates a new flat config (`eslint.config.mjs`) if none exists
   - Updates existing flat configs to include Next.js rules
   - Provides guidance for legacy configs that need manual migration

3. **Installing dependencies automatically**
- Adds required packages: `eslint`, `eslint-config-next`,
`@eslint/eslintrc`
   - Detects and uses the project's package manager (npm/yarn/pnpm/bun)
   - Falls back to manual instructions if installation fails

### Usage

```bash
npx @next/codemod@latest next-lint-to-eslint-cli .
```

### Example transformations

```json
// Before
{
  "scripts": {
    "lint": "next lint",
    "lint:fix": "next lint --fix",
    "lint:strict": "next lint --strict --dir src"
  }
}

// After
{
  "scripts": {
    "lint": "eslint .",
    "lint:fix": "eslint --fix .",
    "lint:strict": "eslint --max-warnings 0 src"
  }
}
```

### Why this change?

- `next lint` is being deprecated and will be removed in Next.js 16
- ESLint v9+ flat config is becoming the standard
- Direct ESLint usage provides more flexibility and better ecosystem
compatibility
- Reduces Next.js maintenance burden of wrapping ESLint functionality

The codemod ensures a smooth transition path for existing Next.js
projects while following ESLint best practices.
2025-08-19 13:27:17 -07:00
Ben Gubler c970d95136 feat: stabilize experimental.typedRoutes flag (#82762)
- Rename `experimental.typedRoutes` to `typedRoutes` 
- Remove old references to `typedRoutes` not working with Turbopack
- Remove unnecessary encoding of `typedRoutes` for bundlers
2025-08-19 11:02:26 -07:00
Ben Gubler 9c1a97bf56 feat: deprecate 'next lint', add Biome support (#82266)
# Transition from `next lint` to explicit ESLint configs and add Biome support

## What?
This PR makes two major changes to Next.js linting:

1. **Transitions away from `next lint`**: `create-next-app` now generates explicit ESLint configurations instead of relying on the `next lint` command
2. **Adds Biome as a linter option**: Users can now choose between ESLint, Biome, or no linter during project setup

## Why?

**ESLint Transition**: Provides transparency (users see exact rules), better IDE integration, easier customization, and follows industry standards for explicit configuration.

**Biome Support**: Offers a faster, unified linting/formatting tool and gives users more choice in their developer experience.

## How?

### ESLint Configuration Generation
- Generates `eslint.config.mjs` files that extend `eslint-config-next` packages
- Includes proper ignores for build artifacts (`next-env.d.ts`, `.next/`, etc.)
- Package.json scripts call `eslint .` directly instead of `next lint`
- Maintains complete feature parity with current `next lint` behavior

### Biome Integration
- Added `--biome` flag and interactive prompt selection
- Generated `biome.json` configurations with Next.js and React domain rules
- Includes both `lint` and `format` scripts for Biome projects

### Linter Selection
Interactive prompt offers: **ESLint** (comprehensive rules), **Biome** (fast with fewer rules), **None** (skip linter)

### Deprecation
Added deprecation warning to `next lint` command (removed in Next.js 16)

## Testing
Added comprehensive test suites for both ESLint and Biome configuration generation across all template variants.

This change modernizes Next.js linting while providing users with more choice and transparency.
2025-08-19 09:54:20 -07:00
Abhishek Ghimire 15653f3a28 Use jsx extension instead of js in global-error documentation (#82710) 2025-08-19 00:44:01 +00:00
Luke Sandberg 1766a1aba6 [turbopack] Update next docs with information about turbopack known adoption issues (#82560)
- Document the experimental persistent caching flag
- Document the gap with the `innerGraph` optimization
- Document the css module ordering issue
- Document the persistent caching gap

Will wait to submit this until the when we publish the release.
2025-08-18 16:32:08 -07:00
Will Binns-Smith 480a0e1db3 create-next-app: use Turbopack for both dev and build (#82753)
Previously, we asked users if they want to use Turbopack for `next dev`.
Now, we ask if they want to use Turbopack, and if they do, we use it for
both dev and build. It’s also listed as `(recommended)` like App Router.

Test Plan: `pnpm build`, `./node_modules/.bin/create-next-app
~/path/to/app`. Choose the Turbopack option. Verify the app uses
Turbopack for both dev and build.
2025-08-18 20:27:30 +00:00
Alexander Kachkaev cbbc8f3e12 Remove stability disclamer on Node runtime in middleware (#82181)
Follows https://github.com/vercel/next.js/pull/81907, removes an
outdated disclaimer from the docs:

https://nextjs.org/docs/app/api-reference/file-conventions/middleware#runtime

<img width="1346" height="852" alt="Screenshot 2025-07-30 at 00 19 01"
src="https://github.com/user-attachments/assets/ebaf9d5e-4f70-4422-bda6-9801fcd52707"
/>

Keeping #81907 unmerged until 15.5 release would make sense, but since
it’s already in, this one can go in too. Merging it after cutting 15.5.0
would also be fine.



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

-->
2025-08-15 13:29:59 -07:00
Adem 88b3223a97 docs: fix typo in vitest.mdx (#82690)
Co-authored-by: Joseph <joseph.chamochumbi@vercel.com>
2025-08-15 16:32:46 +02:00
Jiwon Choi 8606a9e4b0 docs: add experimental.typedEnv (#82647)
I added docs at https://github.com/vercel/next.js/pull/70958, but never
landed on `canary` ~~due to a git rebase skill issue~~.

---------

Co-authored-by: Joseph <joseph.chamochumbi@vercel.com>
Co-authored-by: vercel[bot] <35613825+vercel[bot]@users.noreply.github.com>
2025-08-15 13:31:30 +02:00
Jam Balaya 3c9c995985 docs: fix typos (#82503)
## 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-guide

Co-authored-by: Joseph <joseph.chamochumbi@vercel.com>
2025-08-14 00:28:28 +02:00
Guo Ci e771609a7a Fix generate-metadata.mdx typo (#82624)
<!-- 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>
2025-08-13 23:58:12 +02:00
Joseph 9542b8b038 Docs/feedback round aug (#82549)
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.
2025-08-13 12:17:14 +02:00
Joseph d75d90f3cf docs: experimental config browserDebugInfoInTerminal (#82532)
Adding docs for `browserDebugInfoInTerminal`
2025-08-11 23:08:18 +02:00
Jimmy Lai 46709a2a0e docs: update revalidatePath, revalidateTag docs to be more consistent + highlight res.revalidate case (#82479)
- uses invalidate instead of revalidate to make more explicit the
revalidatePath, revalidateTag behavior
- highlights that eager revalidation can still happen with the pages
router method

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

-->
2025-08-08 11:39:22 -07:00
Kit Foster e30dd09f29 Add path to Image documentation (#82329)
<!-- 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


### How?

Closes NEXT-
Fixes #

-->

### What?

Add the `path` field to the App Router
https://nextjs.org/docs/app/api-reference/components/image and Pages
Router https://nextjs.org/docs/pages/api-reference/components/image
docs. This field is valid for both, and currently it's use is hidden in
the code.

### Why?

Allow people to find and use the field as it is useful for prefixing the
`/_next/image` path.

---------

Co-authored-by: Steven <steven@ceriously.com>
2025-08-08 07:41:22 -07:00
Joseph 2ba4a8548c global-error, revalidatePath and PWA headings (#82408)
Complement to: https://github.com/vercel/next.js/issues/82379

Also adding corrections to other sections
2025-08-07 08:10:21 +00:00
Joseph 6cae6d86b8 docs: polyfills usage in app router (#80447)
Closes:
https://linear.app/vercel/issue/DOC-4752/docs-polyfills-in-app-router

Fixes: https://github.com/vercel/next.js/issues/74730
2025-08-06 21:09:51 +00:00
Joseph a38db346db Docs: Add more info about TW and TW 3 option (#82203)
Closes: https://linear.app/vercel/issue/DOC-4862/tailwind-css-modules

---------

Co-authored-by: Rich Haines <hello@richardhaines.dev>
2025-08-06 20:24:25 +02:00
Joseph 373f3e1de1 fix: implications of global-not-found skipping 'normal' rendering (#82399)
Fixes: https://github.com/vercel/next.js/issues/82379

Also fixing the Metadata snippets at the bottom of the page
2025-08-06 13:13:29 +02:00
Joseph ea08bf273c docs: CSP with SRI corrections (#82365)
Feedback on the csp guide updates
2025-08-06 10:57:48 +02:00
Michal bdd41bbcab Docs: Updating guides on PPR and ISR (#81307)
The PR fixes issues in two different guides. 

### PPR
In PPR, the code for jsx and tsx versions should use the language
switcher. Currently, these are displayed below each other in the guide
which seems unintentional.

### ISR
This change fixes multiple issues:

**fixes in the example:**
the example currently does not match the text below (_Here's how this
example works:_). It says:
> If /blog/26 is requested, Next.js will generate and cache this page
on-demand

that is of course not correct because there are only 25 blog posts
returned from the API. No blog post data is returned for `/blog/26`,
making this example wrong and confusing.

By slicing the posts and supplying only 24 of 25 blog posts for static
generation during the build process, the guide becomes much more
explicit - the 25th blog post can be used for inspecting the workings of
the on-the-fly generation and caching. Turning `dynamicParams` to
`false` or `true`, one can now truly test this behaviour with the 25th
blog.

Second, the same example in Pages Router docs includes:
> return { paths, fallback: false }

In this case, again, this part below:

> If /blog/26 is requested, Next.js will generate and cache this page
on-demand

is incorrect. When setting `fallback` to `false`, the page is never
generated on-demand and returns 404 instead as there is no 26th blog
post in the fetched data. So the fix changes the value of `fallback` to
`blocking`, to mirror the App Router's `dynamicParams` value in the
guide. This makes is more consistent and, more importantly, reproducible
example.

**clarifying the on-demand section:**
The sections dedicated to **on-demand revalidation** do not currently
mention that revalidation works differently from the time-based one. One
may assume the first request after on-demand revalidation returns stale
data (just like time-based).

But that's not true, the next request after on-demand revalidation (with
Server Actions for example) generates the content on-the-fly and returns
fresh data right away. It wasn't clear to me so I tested it myself and
was surprised (and happy) that it is this smart. I think it's very
important to clarify this distinction in the guide.

-----

I hope this makes sense. I'm quite responsive these days and will change
it based on your feedback (if any). Thanks!

<!-- 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>
2025-08-05 18:18:35 +02:00
huperniketes 9e9ee85217 Documentation: Removed reference to treeShaking in 08-turbopack.mdx (#82352) 2025-08-05 10:29:05 +02:00
Joseph 1f8ea2a1b0 docs: Clarify revalidatePath (#82142)
Fixes: https://github.com/vercel/next.js/issues/81776
2025-08-04 20:02:36 +02:00
devin-ai-integration[bot] 9d3069adc7 docs: Improve Content Security Policy documentation (#80580)
# Improve Content Security Policy Documentation

This PR comprehensively improves the Next.js Content Security Policy
(CSP) documentation to address community feedback from Reddit and GitHub
discussions about gaps in the current documentation.

## Changes Made

### 1. Enhanced Nonce Flow Explanation
- Added detailed section explaining how Next.js automatically detects
and applies nonces during server-side rendering
- Clarified the 3-step process: middleware generation → Next.js
extraction → automatic application
- Explained that developers don't need to manually add nonces to every
script tag

### 2. Static vs Dynamic Rendering Documentation
- Added comprehensive section explaining performance implications of
using nonces
- Documented that nonces force all pages into dynamic rendering
- Explained trade-offs: slower page loads, increased server load, no CDN
caching
- Added guidance on when to use nonces vs alternatives

### 3. Experimental SRI (Subresource Integrity) Documentation
- Documented the experimental `sri.algorithm` configuration option
- Explained hash-based CSP as an alternative to nonces that preserves
static generation
- Included configuration examples and benefits/limitations
- Noted that SRI is webpack-only, App Router only, and experimental

### 4. Development vs Production Considerations
- Added section addressing environment-specific CSP requirements
- Documented need for `'unsafe-eval'` in development for HMR
- Provided conditional CSP examples based on NODE_ENV

### 5. Comprehensive Troubleshooting Section
- Added solutions for error pages that don't work with strict CSP
- Documented third-party script integration with CSP
- Included common CSP violation fixes
- Added examples for both App Router and Pages Router

### 6. Practical Examples
- Static site with hash-based CSP using SRI
- Dynamic site with nonce-based CSP
- Mixed approach for different page types
- Environment-aware CSP configuration

### 7. Enhanced Pages Router Documentation
- Added `_document.tsx` nonce access example
- Improved `getServerSideProps` examples
- Added third-party script integration examples

## Community Feedback Addressed

This PR directly addresses the Reddit thread feedback about:
- ❌ "it is not clear that the nonce is then picked up by the rest of the
pages" → ✅ Added detailed nonce flow explanation
- ❌ "it is not clear that the pages therefore are not statically
generated anymore" → ✅ Added static vs dynamic rendering section
- ❌ "The solution of being able to provide the sha256 hashes... is not
supported, and it is not mentioned in the documentation" → ✅ Added
experimental SRI documentation
- ❌ Poor documentation of strict CSP implementation → ✅ Added
comprehensive examples and troubleshooting

## Technical Details

- **File Modified**: `docs/01-app/02-guides/content-security-policy.mdx`
- **Lines Added**: 642 insertions
- **Maintains**: Existing documentation structure and Next.js
conventions
- **Supports**: Both App Router and Pages Router with appropriate
switcher components

## Testing

- Verified all code examples use correct Next.js APIs and patterns
- Ensured documentation follows existing Next.js docs structure
- Confirmed all referenced configuration options exist in the codebase
- Validated that experimental features are properly marked as such

---

**Link to Devin run**:
https://app.devin.ai/sessions/e7e5fa95dc0146b3ab79aac72c53ed13
**Requested by**: lee@vercel.com

---------

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: lee@vercel.com <lee@vercel.com>
Co-authored-by: Joseph Chamochumbi <joseph.chamochumbi@vercel.com>
2025-08-04 18:47:26 +02:00
PuppyOne 6e20a10d76 docs: add React Developer Tools section for debugging (#82320)
## What?

Added a new "React Developer Tools" section to the debugging
documentation.

## Why?

This PR resolves #82308 which highlighted that React DevTools - a
fundamental debugging tool for React applications - was missing from
Next.js debugging documentation.

Since the Next.js framework is built on React, React DevTools is crucial
for:
- Inspecting component hierarchies
- Debugging state and props
- Identifying performance issues
- Understanding application structure

## How?

Inserted a concise section between "Client-side code" and "Server-side
code" in
[docs/01-app/02-guides/debugging.mdx](https://github.com/vercel/next.js/blob/canary/docs/01-app/02-guides/debugging.mdx):

- Introduces developers to the essential React debugging tool and its
key features
- Direct users to the corresponding React documentation

### Checklist: Improving Documentation

- [x] Ran `pnpm prettier-fix` to ensure proper formatting
- [x] Followed the Docs Contribution Guide:
https://nextjs.org/docs/community/contribution-guide


Closes #82308

Co-authored-by: Joseph <joseph.chamochumbi@vercel.com>
2025-08-04 16:19:17 +02:00
Štěpán Granát 49ac27c137 docs: Add Tolgee to app router localization resources (#81366)
Adding Tolgee to available i18n providers.

## Why
Tolgee is listed only in the pages-router, but it actually supports
app-router as well.
2025-08-01 21:20:40 +00:00
KimJunYoung 5083e606e6 docs: to indicate that redirect can be used in both server and client… (#82092)
<img width="591" height="132" alt="image"
src="https://github.com/user-attachments/assets/9c9c64fe-4095-4127-a893-1c12426d9700"
/>

- When I first read the explanation, it felt as if `redirect` couldn’t
be used in client components.
- Also, when clicking the `Server Components` link, it leads to the
`Server and Client Components` page.
- To indicate that `redirect` can be used in both `server and client
components`, rename the hyperlink text in the `redirect.mdx` file.

---------

Co-authored-by: Joseph <joseph.chamochumbi@vercel.com>
2025-08-01 12:42:47 +02:00
Joseph dd2e89a95e docs: App Router's React version (#82180)
Closes:
https://linear.app/vercel/issue/DOC-4930/notes-about-app-routers-react-version

---------

Co-authored-by: Rich Haines <hello@richardhaines.dev>
2025-07-30 13:26:52 +02:00
Joseph f1658d44ab docs: Add more links to app docs root (#82126)
This page https://nextjs.org/docs/app has too little actionable paths to
go on
2025-07-30 12:14:55 +02:00