Skip to content

Commit ad17ea6

Browse files
authored
docs: update core documentation for Turbopack as default bundler (#84282)
Update next.js docs to account for turbopack being the default bundler.
1 parent 6b72050 commit ad17ea6

File tree

8 files changed

+83
-57
lines changed

8 files changed

+83
-57
lines changed

docs/01-app/01-getting-started/01-installation.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ Then, add the following scripts to your `package.json` file:
101101
```json filename="package.json"
102102
{
103103
"scripts": {
104-
"dev": "next dev --turbopack",
104+
"dev": "next dev",
105105
"build": "next build",
106106
"start": "next start",
107107
"lint": "eslint",
@@ -112,12 +112,12 @@ Then, add the following scripts to your `package.json` file:
112112

113113
These scripts refer to the different stages of developing an application:
114114

115-
- `next dev --turbopack`: Starts the development server using Turbopack.
115+
- `next dev`: Starts the development server using Turbopack (default bundler).
116116
- `next build`: Builds the application for production.
117117
- `next start`: Starts the production server.
118118
- `eslint`: Runs ESLint.
119119

120-
Turbopack is stable for `dev`. For production builds, Turbopack is in beta. To try it, run `next build --turbopack`. See the [Turbopack docs](/docs/app/api-reference/turbopack) for status and caveats.
120+
Turbopack is now the default bundler. To use Webpack run `next dev --webpack` or `next build --webpack`. See the [Turbopack docs](/docs/app/api-reference/turbopack) for configuration details.
121121

122122
<AppOnly>
123123

docs/01-app/02-guides/custom-server.mdx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,8 @@ The above `next` import is a function that receives an object with the following
9696
| `hostname` | `String` | (_Optional_) The hostname the server is running behind |
9797
| `port` | `Number` | (_Optional_) The port the server is running behind |
9898
| `httpServer` | `node:http#Server` | (_Optional_) The HTTP Server that Next.js is running behind |
99-
| `turbo` | `Boolean` | (_Optional_) Enable Turbopack |
99+
| `turbopack` | `Boolean` | (_Optional_) Enable Turbopack (enabled by default) |
100+
| `webpack` | `Boolean` | (_Optional_) Enable webpack |
100101

101102
The returned `app` can then be used to let Next.js handle requests as required.
102103

docs/01-app/02-guides/local-development.mdx

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,21 @@ On macOS, you can disable [Gatekeeper](https://support.apple.com/guide/security/
4848

4949
If you or your employer have configured any other Antivirus solutions on your system, you should inspect the relevant settings for those products.
5050

51-
### 2. Update Next.js and enable Turbopack
51+
### 2. Update Next.js and use Turbopack
5252

5353
Make sure you're using the latest version of Next.js. Each new version often includes performance improvements.
5454

55-
Turbopack is a new bundler integrated into Next.js that can improve local performance.
55+
Turbopack is now the default bundler for Next.js development and provides significant performance improvements over webpack.
5656

5757
```bash
5858
npm install next@latest
59-
npm run dev --turbopack
59+
npm run dev # Turbopack is used by default
60+
```
61+
62+
If you need to use Webpack instead of Turbopack, you can opt-in:
63+
64+
```bash
65+
npm run dev --webpack
6066
```
6167

6268
[Learn more about Turbopack](/blog/turbopack-for-development-stable). See our [upgrade guides](/docs/app/guides/upgrading) and codemods for more information.
@@ -146,7 +152,7 @@ Tailwind CSS version 3.4.8 or newer will warn you about settings that might slow
146152

147153
If you've added custom webpack settings, they might be slowing down compilation.
148154

149-
Consider if you really need them for local development. You can optionally only include certain tools for production builds, or explore moving to Turbopack and using [loaders](/docs/app/api-reference/config/next-config-js/turbopack#supported-loaders).
155+
Consider if you really need them for local development. You can optionally only include certain tools for production builds, or explore using the default Turbopack bundler and configuring [loaders](/docs/app/api-reference/config/next-config-js/turbopack#configuring-webpack-loaders) instead.
150156

151157
### 6. Optimize memory usage
152158

docs/01-app/02-guides/migrating/from-create-react-app.mdx

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,7 @@ Update your `package.json` scripts to use Next.js commands. Also, add `.next` an
455455
```json filename="package.json"
456456
{
457457
"scripts": {
458-
"dev": "next dev --turbopack",
458+
"dev": "next dev",
459459
"build": "next build",
460460
"start": "npx serve@latest ./build"
461461
}
@@ -526,7 +526,7 @@ const nextConfig: NextConfig = {
526526
}
527527
```
528528

529-
### Custom Webpack / Babel Config
529+
### Custom Webpack
530530

531531
If you had a custom webpack or Babel configuration in CRA, you can extend Next.js’s config in `next.config.ts`:
532532

@@ -543,7 +543,7 @@ const nextConfig: NextConfig = {
543543
export default nextConfig
544544
```
545545

546-
> **Note**: This will require disabling Turbopack by removing `--turbopack` from your `dev` script.
546+
> **Note**: This will require using Webpack by adding `--webpack` to your `dev` script.
547547
548548
### TypeScript Setup
549549

@@ -557,10 +557,16 @@ Next.js automatically sets up TypeScript if you have a `tsconfig.json`. Make sur
557557

558558
## Bundler Compatibility
559559

560-
Both Create React App and Next.js default to webpack for bundling. Next.js also offers [Turbopack](/docs/app/api-reference/config/next-config-js/turbopack) for faster local development with:
560+
Create React App uses webpack for bundling. Next.js now defaults to [Turbopack](/docs/app/api-reference/config/next-config-js/turbopack) for faster local development:
561561

562562
```bash
563-
next dev --turbopack
563+
next dev # Uses Turbopack by default
564+
```
565+
566+
To use Webpack instead (similar to CRA):
567+
568+
```bash
569+
next dev --webpack
564570
```
565571

566572
You can still provide a [custom webpack configuration](/docs/app/api-reference/config/next-config-js/webpack) if you need to migrate advanced webpack settings from CRA.

docs/01-app/03-api-reference/05-config/01-next-config-js/turbopack.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,8 @@ In addition, a number of built-in conditions are supported:
186186

187187
- `browser`: Matches code that will execute on the client. Server code can be matched using `{not: 'browser'}`.
188188
- `foreign`: Matches code in `node_modules`, as well as some Next.js internals. Usually you'll want to restrict loaders to `{not: 'foreign'}`. This can improve performance by reducing the number of files the loader is invoked on.
189-
- `development`: Matches when using `next dev --turbopack`.
190-
- `production`: Matches when using `next build --turbopack`.
189+
- `development`: Matches when using `next dev`.
190+
- `production`: Matches when using `next build`.
191191
- `node`: Matches code that will run on the default Node.js runtime.
192192
- `edge-light`: Matches code that will run on the [Edge runtime](/docs/app/api-reference/edge).
193193

docs/01-app/03-api-reference/06-cli/create-next-app.mdx

Lines changed: 28 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -17,33 +17,34 @@ npx create-next-app@latest [project-name] [options]
1717

1818
The following options are available:
1919

20-
| Options | Description |
21-
| --------------------------------------- | --------------------------------------------------------------- |
22-
| `-h` or `--help` | Show all available options |
23-
| `-v` or `--version` | Output the version number |
24-
| `--no-*` | Negate default options. E.g. `--no-ts` |
25-
| `--ts` or `--typescript` | Initialize as a TypeScript project (default) |
26-
| `--js` or `--javascript` | Initialize as a JavaScript project |
27-
| `--tailwind` | Initialize with Tailwind CSS config (default) |
28-
| `--eslint` | Initialize with ESLint config |
29-
| `--biome` | Initialize with Biome config |
30-
| `--no-linter` | Skip linter configuration |
31-
| `--app` | Initialize as an App Router project |
32-
| `--api` | Initialize a project with only route handlers |
33-
| `--src-dir` | Initialize inside a `src/` directory |
34-
| `--turbopack` | Enable Turbopack by default for development |
35-
| `--import-alias <alias-to-configure>` | Specify import alias to use (default "@/\*") |
36-
| `--empty` | Initialize an empty project |
37-
| `--use-npm` | Explicitly tell the CLI to bootstrap the application using npm |
38-
| `--use-pnpm` | Explicitly tell the CLI to bootstrap the application using pnpm |
39-
| `--use-yarn` | Explicitly tell the CLI to bootstrap the application using Yarn |
40-
| `--use-bun` | Explicitly tell the CLI to bootstrap the application using Bun |
41-
| `-e` or `--example [name] [github-url]` | An example to bootstrap the app with |
42-
| `--example-path <path-to-example>` | Specify the path to the example separately |
43-
| `--reset-preferences` | Explicitly tell the CLI to reset any stored preferences |
44-
| `--skip-install` | Explicitly tell the CLI to skip installing packages |
45-
| `--disable-git` | Explicitly tell the CLI to disable git initialization |
46-
| `--yes` | Use previous preferences or defaults for all options |
20+
| Options | Description |
21+
| --------------------------------------- | --------------------------------------------------------------------- |
22+
| `-h` or `--help` | Show all available options |
23+
| `-v` or `--version` | Output the version number |
24+
| `--no-*` | Negate default options. E.g. `--no-ts` |
25+
| `--ts` or `--typescript` | Initialize as a TypeScript project (default) |
26+
| `--js` or `--javascript` | Initialize as a JavaScript project |
27+
| `--tailwind` | Initialize with Tailwind CSS config (default) |
28+
| `--eslint` | Initialize with ESLint config |
29+
| `--biome` | Initialize with Biome config |
30+
| `--no-linter` | Skip linter configuration |
31+
| `--app` | Initialize as an App Router project |
32+
| `--api` | Initialize a project with only route handlers |
33+
| `--src-dir` | Initialize inside a `src/` directory |
34+
| `--turbopack` | Force enable Turbopack in generated package.json (enabled by default) |
35+
| `--webpack` | Force enable Webpack in generated package.json |
36+
| `--import-alias <alias-to-configure>` | Specify import alias to use (default "@/\*") |
37+
| `--empty` | Initialize an empty project |
38+
| `--use-npm` | Explicitly tell the CLI to bootstrap the application using npm |
39+
| `--use-pnpm` | Explicitly tell the CLI to bootstrap the application using pnpm |
40+
| `--use-yarn` | Explicitly tell the CLI to bootstrap the application using Yarn |
41+
| `--use-bun` | Explicitly tell the CLI to bootstrap the application using Bun |
42+
| `-e` or `--example [name] [github-url]` | An example to bootstrap the app with |
43+
| `--example-path <path-to-example>` | Specify the path to the example separately |
44+
| `--reset-preferences` | Explicitly tell the CLI to reset any stored preferences |
45+
| `--skip-install` | Explicitly tell the CLI to skip installing packages |
46+
| `--disable-git` | Explicitly tell the CLI to disable git initialization |
47+
| `--yes` | Use previous preferences or defaults for all options |
4748

4849
## Examples
4950

docs/01-app/03-api-reference/06-cli/next.mdx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ The following commands are available:
4646
| ---------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
4747
| `-h, --help` | Show all available options. |
4848
| `[directory]` | A directory in which to build the application. If not provided, current directory is used. |
49-
| `--turbopack` | Starts development mode using [Turbopack](/docs/app/api-reference/turbopack). Also available as `--turbo`. |
49+
| `--turbopack` | Force enable [Turbopack](/docs/app/api-reference/turbopack) (enabled by default). Also available as `--turbo`. |
50+
| `--webpack` | Use Webpack instead of the default [Turbopack](/docs/app/api-reference/turbopack) bundler for development. |
5051
| `-p` or `--port <port>` | Specify a port number on which to start the application. Default: 3000, env: PORT |
5152
| `-H`or `--hostname <hostname>` | Specify a hostname on which to start the application. Useful for making the application available for other devices on the network. Default: 0.0.0.0 |
5253
| `--experimental-https` | Starts the server with HTTPS and generates a self-signed certificate. |
@@ -74,7 +75,8 @@ The following options are available for the `next build` command:
7475
| ---------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
7576
| `-h, --help` | Show all available options. |
7677
| `[directory]` | A directory on which to build the application. If not provided, the current directory will be used. |
77-
| `--turbopack` | Build using [Turbopack](/docs/app/api-reference/turbopack) (beta). Also available as `--turbo`. |
78+
| `--turbopack` | Force enable [Turbopack](/docs/app/api-reference/turbopack) (enabled by default). Also available as `--turbo`. |
79+
| `--webpack` | Build using Webpack. |
7880
| `-d` or `--debug` | Enables a more verbose build output. With this flag enabled additional build output like rewrites, redirects, and headers will be shown. |
7981
| |
8082
| `--profile` | Enables production [profiling for React](https://react.dev/reference/react/Profiler). |

docs/01-app/03-api-reference/08-turbopack.mdx

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,31 @@ We built Turbopack to push the performance of Next.js, including:
1818

1919
## Getting started
2020

21-
To enable Turbopack in your Next.js project, add the `--turbopack` flag to the `dev` and `build` scripts in your `package.json` file:
21+
Turbopack is now the **default bundler** in Next.js. No configuration is needed to use Turbopack:
2222

2323
```json filename="package.json" highlight={3}
2424
{
2525
"scripts": {
26-
"dev": "next dev --turbopack",
27-
"build": "next build --turbopack",
26+
"dev": "next dev",
27+
"build": "next build",
2828
"start": "next start"
2929
}
3030
}
3131
```
3232

33-
Currently, Turbopack for `dev` is stable, while `build` is in beta. We are actively working on production support as Turbopack moves closer to stability.
33+
### Using Webpack instead
34+
35+
If you need to use Webpack instead of Turbopack, you can opt-in with the `--webpack` flag:
36+
37+
```json filename="package.json"
38+
{
39+
"scripts": {
40+
"dev": "next dev --webpack",
41+
"build": "next build --webpack",
42+
"start": "next start"
43+
}
44+
}
45+
```
3446

3547
## Supported features
3648

@@ -204,7 +216,7 @@ For more in-depth configuration examples, see the [Turbopack config documentatio
204216
If you encounter performance or memory issues and want to help the Next.js team diagnose them, you can generate a trace file by appending `NEXT_TURBOPACK_TRACING=1` to your dev command:
205217

206218
```bash
207-
NEXT_TURBOPACK_TRACING=1 next dev --turbopack
219+
NEXT_TURBOPACK_TRACING=1 next dev
208220
```
209221

210222
This will produce a `.next/trace-turbopack` file. Include that file when creating a GitHub issue on the [Next.js repo](https://github.com/vercel/next.js) to help us investigate.
@@ -213,13 +225,11 @@ This will produce a `.next/trace-turbopack` file. Include that file when creatin
213225

214226
Turbopack is a **Rust-based**, **incremental** bundler designed to make local development and builds fast—especially for large applications. It is integrated into Next.js, offering zero-config CSS, React, and TypeScript support.
215227

216-
Stay tuned for more updates as we continue to improve Turbopack and add production build support. In the meantime, give it a try with `next dev --turbopack` and let us know your feedback.
217-
218228
## Version Changes
219229

220-
| Version | Changes |
221-
| --------- | -------------------------------------------------------------- |
222-
| `v16.0.0` | Automatic support for Babel when a configuration file is found |
223-
| `v15.5.0` | Turbopack support for `build` beta |
224-
| `v15.3.0` | Experimental support for `build` |
225-
| `v15.0.0` | Turbopack for `dev` stable |
230+
| Version | Changes |
231+
| --------- | ----------------------------------------------------------------------------------------------------------------- |
232+
| `v16.0.0` | Turbopack becomes the default bundler for Next.js. Automatic support for Babel when a configuration file is found |
233+
| `v15.5.0` | Turbopack support for `build` beta |
234+
| `v15.3.0` | Experimental support for `build` |
235+
| `v15.0.0` | Turbopack for `dev` stable |

0 commit comments

Comments
 (0)