15 Commits

Author SHA1 Message Date
Joseph 7ec73949fc docs: clarify instrumentation-client polyfill loading and hydration timing (#95988)
The `instrumentation-client` Polyfills docs recommended a conditional
dynamic `import().then()` to load a polyfill. That import is
fire-and-forget: Next.js loads this file synchronously and does not
await it before hydration, so the polyfill can install after components
have already run (see #83905).

- In "Execution timing" mention that only synchronous top-level code
completes before hydration. Call out that a conditional `import()` here
is not awaited, and cross-reference `supported-browsers` for
load-on-demand strategies and the built-in baseline.

- In **`supported-browsers.mdx`**, "fix" the `Conditionally loading
polyfills` example to `await import()` instead of a floating `.then()`,
otherwise, a reader needs to put their code within the `.then` chain of
the polyfill load.

Closes:
https://linear.app/vercel/issue/DOC-6506/revisit-polyfills-with-instrumentation-client
2026-07-28 15:44:03 -04:00
Cody Coljee-Gray 2a4737927b Fix typo in Fast Refresh documentation (#85352)
Small grammar fix for fast-refresh.mdx

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

Small grammer update on page introduction.

### Why?

This makes the sentence more readable.

### How?

N/A

Closes NEXT-
Fixes #

-->

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2025-10-27 18:14:45 +00:00
Niklas Mischkulnig afaf42b95c [Breaking] Update default browserslist config (#84401)
Use the current result of `baseline widely available` as the default
browsers.
If we used `baseline widely available` literally, then that would change
the targets even within minor versions.
2025-10-01 21:29:54 +02:00
Joseph 3552445eba Docs/polyfills fix pages only (#82462)
Follow up for: https://github.com/vercel/next.js/issues/74730
2025-08-08 10:45:32 +02: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
Will Binns-Smith 94b246469e next.config.ts: Implement compiler.defineServer for server-only constants (#79225)
Like `compiler.define`, this allows users to create compile-time
constants both Turbopack and webpack from a single API.
`compiler.defineServer` instead only makes these constants available for
server or edge environments, not the client environment.
2025-05-19 12:25:46 -07:00
Jude Gao a64130eba1 doc: add build lifecycle hooks documentation (#78842)
Added documentation for the new Build Lifecycle Hooks feature in the
Next.js Compiler, specifically the `runAfterProductionCompile` hook.

https://github.com/vercel/next.js/pull/77345
2025-05-06 14:13:55 +01:00
Delba de Oliveira 7a64ada1ab docs: Move pages from Config section into guides (#78496) 2025-04-24 07:28:50 -05:00
Delba de Oliveira ae1cad07dd Docs IA 2.0: Move version upgrade docs under Guides (#78189)
Closes: https://linear.app/vercel/issue/DOC-4539/version-upgrade-guides

Redirects: https://github.com/vercel/front/pull/44175

Move version upgrade guides under `Guides`. Also creates a guides
section under the Pages docs.
2025-04-15 16:00:54 +01:00
Apostolos Tsakpinis 6319dbb089 Typo in nextjs-compiler.mdx (#74645)
Adds missing word in:
`minification cannot customized using`
to:
`minification cannot be customized using`

<!-- 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-01-11 12:15:59 -08:00
Joseph 39bde00e66 docs: Add note about remove of the swcMinify flag (#73281)
### What?

Docs update.

As noted in, https://github.com/vercel/next.js/issues/73267, swcMinify,
is still listed in the documentation, though the flag has been removed.

### Why?

The flag has been removed.

### How?

Add a note, for reference, that the flag has been removed, rather than
dropping the entire Minification section.

I wonder, though, what is the recommended way to opt-out, and into
Terser again, should you find an issue with SWC's minification?
Hi-jacking the minifier in the Webpack config object?

Fixes #73267

---------

Co-authored-by: Delba de Oliveira <32464864+delbaoliveira@users.noreply.github.com>
2024-12-03 14:01:21 +00:00
Delba de Oliveira e8af80de75 Docs: Update turbopack API Reference (#73215)
Closes: https://linear.app/vercel/issue/DOC-3886/[page]-turbopack

- Moves `Turbopack` page under API Reference
- Shares page between `app` and `pages` docs
- Updates page to follow template

Redirects: https://github.com/vercel/front/pull/38704
2024-11-26 15:23:28 +00:00
Luca Forstner 1b1cb3eece Add compiler.define option (#71802)
Adds a `compiler.define` option to next.config.js to statically replace
any variables during build-time for Turbopack. This is similar to
Webpack's `DefinePlugin`.

Relates to: https://github.com/vercel/next.js/discussions/71476

---------

Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
2024-11-12 21:13:47 +01:00
Delba de Oliveira 0b35ddd825 Docs: Move next.config.js API pages under a config folder, fix headings in TS and ESLint config pages (#72465)
This PR:

- Moves `next.config.js` options under a "config" folder which includes
references for other configuration such as the ESLint plugin. I figure
it would be tidier than having "Next.config.js Options" and "Config" in
the API reference.
- Fixes the issue with the "config" folder not showing up in canary:
https://linear.app/vercel/issue/DOC-3749/bug-figure-out-why-new-config-folder-isnt-showing-up-in-the-canary
- Fixes the indentation issues and missing example header (caused by an
invisible character).

Redirects: https://github.com/vercel/front/pull/38704
2024-11-08 14:48:55 +00:00
Delba de Oliveira fa8d558154 Docs: Split Getting Started between App and Pages, improve Installation page (#72178)
Prepare **Getting Started** Section for upcoming changes, and work on
the first page: `Installation`.

Closes: 
-
https://linear.app/vercel/issue/DOC-3703/update-how-getting-started-is-handled-in-next-site
-
https://linear.app/vercel/issue/DOC-3694/page-how-to-set-up-a-new-nextjs-project-installation
- https://linear.app/vercel/issue/DOC-3707/create-subsection-for-plugins
- https://linear.app/vercel/issue/DOC-3709/eslint-plugin-api-reference
- https://linear.app/vercel/issue/DOC-3710/typescript-reference-page

### Key Changes: 

- Duplicate Getting Started Section between App and Pages Router docs 
- Since getting started will vary between the routers, each docs needs
to have their own Getting Started section
- Reorganize folder numbers
   
**Installation Page**: 
- Split app and pages router specific information
- Rename "Installation" to "How to set up a Next.js application" for SEO
- Add setup instructions for **TypeScript**
- Add setup instructions for **ESLint**
- Add setup instructions for **Absolute Imports and Module Path
Aliases**

**Side effects from moving content around**:
- Create a subsection in API Reference called **Configuration**. 
   - Add ESLint Plugin page, and update it to follow template
   - Add TypeScript page, and update it to follow template
- Remove the **Absolute Imports and Module Path Aliases** page, it's
small enough to live under the set up instructions.

---------

Co-authored-by: Rich Haines <hello@richardhaines.dev>
2024-11-06 12:32:05 +00:00