Skip to content

Commit b3f46ec

Browse files
committed
Turbopack: update docs for config.turbopack
As `turbo.mdx` is renamed to `turbopack.mdx`, we’ll need a redirect on the nextjs.org website to take users to the new location. This will be a separate PR in its repository.
1 parent f170b0a commit b3f46ec

File tree

5 files changed

+49
-71
lines changed

5 files changed

+49
-71
lines changed

docs/01-app/03-building-your-application/06-optimizing/14-local-development.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ Tailwind CSS version 3.4.8 or newer will warn you about settings that might slow
114114

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

117-
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/turbo#supported-loaders).
117+
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).
118118

119119
### 6. Optimize memory usage
120120

docs/01-app/03-building-your-application/11-upgrading/06-from-create-react-app.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,7 @@ 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/turbo) for faster local development with:
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:
561561

562562
```bash
563563
next dev --turbopack

docs/01-app/05-api-reference/05-config/01-next-config-js/turbo.mdx renamed to docs/01-app/05-api-reference/05-config/01-next-config-js/turbopack.mdx

+23-43
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,18 @@
11
---
2-
title: turbo
2+
title: turbopack
33
description: Configure Next.js with Turbopack-specific options
4-
version: experimental
54
---
65

76
{/* The content of this doc is shared between the app and pages router. You can use the `<PagesOnly>Content</PagesOnly>` component to add content that is specific to the Pages Router. Any shared content should not be wrapped in a component. */}
87

9-
The `turbo` option lets you customize [Turbopack](/docs/app/api-reference/turbopack) to transform different files and change how modules are resolved.
8+
The `turbopack` option lets you customize [Turbopack](/docs/app/api-reference/turbopack) to transform different files and change how modules are resolved.
109

1110
```ts filename="next.config.ts" switcher
1211
import type { NextConfig } from 'next'
1312

1413
const nextConfig: NextConfig = {
15-
experimental: {
16-
turbo: {
17-
// ...
18-
},
14+
turbopack: {
15+
// ...
1916
},
2017
}
2118

@@ -25,10 +22,8 @@ export default nextConfig
2522
```js filename="next.config.js" switcher
2623
/** @type {import('next').NextConfig} */
2724
const nextConfig = {
28-
experimental: {
29-
turbo: {
30-
// ...
31-
},
25+
turbopack: {
26+
// ...
3227
},
3328
}
3429

@@ -82,13 +77,11 @@ Here is an example below using the [`@svgr/webpack`](https://www.npmjs.com/packa
8277

8378
```js filename="next.config.js"
8479
module.exports = {
85-
experimental: {
86-
turbo: {
87-
rules: {
88-
'*.svg': {
89-
loaders: ['@svgr/webpack'],
90-
as: '*.js',
91-
},
80+
turbopack: {
81+
rules: {
82+
'*.svg': {
83+
loaders: ['@svgr/webpack'],
84+
as: '*.js',
9285
},
9386
},
9487
},
@@ -105,12 +98,10 @@ To configure resolve aliases, map imported patterns to their new destination in
10598

10699
```js filename="next.config.js"
107100
module.exports = {
108-
experimental: {
109-
turbo: {
110-
resolveAlias: {
111-
underscore: 'lodash',
112-
mocha: { browser: 'mocha/browser-entry.js' },
113-
},
101+
turbopack: {
102+
resolveAlias: {
103+
underscore: 'lodash',
104+
mocha: { browser: 'mocha/browser-entry.js' },
114105
},
115106
},
116107
}
@@ -128,18 +119,8 @@ To configure resolve extensions, use the `resolveExtensions` field in `next.conf
128119

129120
```js filename="next.config.js"
130121
module.exports = {
131-
experimental: {
132-
turbo: {
133-
resolveExtensions: [
134-
'.mdx',
135-
'.tsx',
136-
'.ts',
137-
'.jsx',
138-
'.js',
139-
'.mjs',
140-
'.json',
141-
],
142-
},
122+
turbopack: {
123+
resolveExtensions: ['.mdx', '.tsx', '.ts', '.jsx', '.js', '.mjs', '.json'],
143124
},
144125
}
145126
```
@@ -161,16 +142,15 @@ To configure the module IDs strategy, use the `moduleIdStrategy` field in `next.
161142

162143
```js filename="next.config.js"
163144
module.exports = {
164-
experimental: {
165-
turbo: {
166-
moduleIdStrategy: 'deterministic',
167-
},
145+
turbopack: {
146+
moduleIdStrategy: 'deterministic',
168147
},
169148
}
170149
```
171150

172151
## Version History
173152

174-
| Version | Changes |
175-
| -------- | -------------------------------- |
176-
| `13.0.0` | `experimental.turbo` introduced. |
153+
| Version | Changes |
154+
| -------- | ----------------------------------------------- |
155+
| `15.3.0` | `experimental.turbo` is changed to `turbopack`. |
156+
| `13.0.0` | `experimental.turbo` introduced. |

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

+23-25
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,13 @@ Turbopack in Next.js has **zero-configuration** for the common use cases. Below
3838

3939
### Language features
4040

41-
| Feature | Status | Notes |
42-
| --------------------------- | --------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
43-
| **JavaScript & TypeScript** | **Supported** | Uses SWC under the hood. Type-checking is not done by Turbopack (run `tsc --watch` or rely on your IDE for type checks). |
44-
| **ECMAScript (ESNext)** | **Supported** | Turbopack supports the latest ECMAScript features, matching SWC’s coverage. |
45-
| **CommonJS** | **Supported** | `require()` syntax is handled out of the box. |
46-
| **ESM** | **Supported** | Static and dynamic `import` are fully supported. |
47-
| **Babel** | Partially Unsupported | Turbopack does not include Babel by default. However, you can [configure `babel-loader` via the Turbopack config](/docs/app/api-reference/config/next-config-js/turbo#configuring-webpack-loaders). |
41+
| Feature | Status | Notes |
42+
| --------------------------- | --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
43+
| **JavaScript & TypeScript** | **Supported** | Uses SWC under the hood. Type-checking is not done by Turbopack (run `tsc --watch` or rely on your IDE for type checks). |
44+
| **ECMAScript (ESNext)** | **Supported** | Turbopack supports the latest ECMAScript features, matching SWC’s coverage. |
45+
| **CommonJS** | **Supported** | `require()` syntax is handled out of the box. |
46+
| **ESM** | **Supported** | Static and dynamic `import` are fully supported. |
47+
| **Babel** | Partially Unsupported | Turbopack does not include Babel by default. However, you can [configure `babel-loader` via the Turbopack config](/docs/app/api-reference/config/next-config-js/turbopack#configuring-webpack-loaders). |
4848

4949
### Framework and React features
5050

@@ -77,12 +77,12 @@ Turbopack in Next.js has **zero-configuration** for the common use cases. Below
7777

7878
### Module resolution
7979

80-
| Feature | Status | Notes |
81-
| --------------------- | ------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- |
82-
| **Path Aliases** | **Supported** | Reads `tsconfig.json`'s `paths` and `baseUrl`, matching Next.js behavior. |
83-
| **Manual Aliases** | **Supported** | [Configure `resolveAlias` in `next.config.js`](/docs/app/api-reference/config/next-config-js/turbo#resolving-aliases) (similar to `webpack.resolve.alias`). |
84-
| **Custom Extensions** | **Supported** | [Configure `resolveExtensions` in `next.config.js`](/docs/app/api-reference/config/next-config-js/turbo#resolving-custom-extensions). |
85-
| **AMD** | Partially Supported | Basic transforms work; advanced AMD usage is limited. |
80+
| Feature | Status | Notes |
81+
| --------------------- | ------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- |
82+
| **Path Aliases** | **Supported** | Reads `tsconfig.json`'s `paths` and `baseUrl`, matching Next.js behavior. |
83+
| **Manual Aliases** | **Supported** | [Configure `resolveAlias` in `next.config.js`](/docs/app/api-reference/config/next-config-js/turbopack#resolving-aliases) (similar to `webpack.resolve.alias`). |
84+
| **Custom Extensions** | **Supported** | [Configure `resolveExtensions` in `next.config.js`](/docs/app/api-reference/config/next-config-js/turbopack#resolving-custom-extensions). |
85+
| **AMD** | Partially Supported | Basic transforms work; advanced AMD usage is limited. |
8686

8787
### Performance and Fast Refresh
8888

@@ -102,7 +102,7 @@ Some features are not yet implemented or not planned:
102102
- The `@value` rule (superseded by CSS variables).
103103
- `:import` and `:export` ICSS rules.
104104
- **`webpack()` configuration** in `next.config.js`
105-
Turbopack replaces webpack, so `webpack()` configs are not recognized. Use the [`experimental.turbo` config](/docs/app/api-reference/config/next-config-js/turbo) instead.
105+
Turbopack replaces webpack, so `webpack()` configs are not recognized. Use the [`experimental.turbo` config](/docs/app/api-reference/config/next-config-js/turbopack) instead.
106106
- **AMP**
107107
Not planned for Turbopack support in Next.js.
108108
- **Yarn PnP**
@@ -118,14 +118,14 @@ Some features are not yet implemented or not planned:
118118
- `experimental.fallbackNodePolyfills`
119119
We plan to implement these in the future.
120120

121-
For a full, detailed breakdown of each feature flag and its status, see the [Turbopack API Reference](/docs/app/api-reference/config/next-config-js/turbo).
121+
For a full, detailed breakdown of each feature flag and its status, see the [Turbopack API Reference](/docs/app/api-reference/config/next-config-js/turbopack).
122122

123123
## Configuration
124124

125-
Turbopack can be configured via `next.config.js` (or `next.config.ts`) under the `experimental.turbo` key. Configuration options include:
125+
Turbopack can be configured via `next.config.js` (or `next.config.ts`) under the `turbopack` key. Configuration options include:
126126

127127
- **`rules`**
128-
Define additional [webpack loaders](/docs/app/api-reference/config/next-config-js/turbo#configuring-webpack-loaders) for file transformations.
128+
Define additional [webpack loaders](/docs/app/api-reference/config/next-config-js/turbopack#configuring-webpack-loaders) for file transformations.
129129
- **`resolveAlias`**
130130
Create manual aliases (like `resolve.alias` in webpack).
131131
- **`resolveExtensions`**
@@ -139,19 +139,17 @@ Turbopack can be configured via `next.config.js` (or `next.config.ts`) under the
139139

140140
```js filename="next.config.js"
141141
module.exports = {
142-
experimental: {
143-
turbo: {
144-
// Example: adding an alias and custom file extension
145-
resolveAlias: {
146-
underscore: 'lodash',
147-
},
148-
resolveExtensions: ['.mdx', '.tsx', '.ts', '.jsx', '.js', '.json'],
142+
turbopack: {
143+
// Example: adding an alias and custom file extension
144+
resolveAlias: {
145+
underscore: 'lodash',
149146
},
147+
resolveExtensions: ['.mdx', '.tsx', '.ts', '.jsx', '.js', '.json'],
150148
},
151149
}
152150
```
153151

154-
For more in-depth configuration examples, see the [Turbopack config documentation](/docs/app/api-reference/config/next-config-js/turbo).
152+
For more in-depth configuration examples, see the [Turbopack config documentation](/docs/app/api-reference/config/next-config-js/turbopack).
155153

156154
## Generating trace files for performance debugging
157155

docs/02-pages/03-api-reference/04-config/01-next-config-js/turbo.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: turbo
33
description: Configure Next.js with Turbopack-specific options
44
version: experimental
5-
source: app/api-reference/config/next-config-js/turbo
5+
source: app/api-reference/config/next-config-js/turbopack
66
---
77

88
{/* DO NOT EDIT. The content of this doc is generated from the source above. To edit the content of this page, navigate to the source page in your editor. You can use the `<PagesOnly>Content</PagesOnly>` component to add content that is specific to the Pages Router. Any shared content should not be wrapped in a component. */}

0 commit comments

Comments
 (0)