Skip to content

Commit 96ad55d

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 1dd0b6e commit 96ad55d

File tree

5 files changed

+59
-70
lines changed

5 files changed

+59
-70
lines changed

Diff for: 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

Diff for: 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

Diff for: 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

+33-42
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

@@ -51,8 +46,6 @@ The following options are available for the `turbo` configuration:
5146
| `resolveAlias` | Map aliased imports to modules to load in their place. |
5247
| `resolveExtensions` | List of extensions to resolve when importing files. |
5348
| `moduleIds` | Assign module IDs |
54-
| `treeShaking` | Enable tree shaking for the turbopack dev server and build. |
55-
| `memoryLimit` | A target memory limit for turbo, in bytes. |
5649

5750
### Supported loaders
5851

@@ -66,6 +59,17 @@ The following loaders have been tested to work with Turbopack's webpack loader i
6659
- [`raw-loader`](https://www.npmjs.com/package/raw-loader)
6760
- [`sass-loader`](https://www.npmjs.com/package/sass-loader)
6861

62+
### Experimental options
63+
64+
Experimental options for Turbopack are available under the top-level `experimental` key in `next.config.js`:
65+
66+
| Option | Description |
67+
| ---------------------- | ------------------------------------------------------------------------- |
68+
| `turbopackTreeShaking` | Enable tree shaking for the turbopack dev server and build. |
69+
| `turbopackMemoryLimit` | A target memory limit for turbo, in bytes. |
70+
| `turbopackSourceMaps` | Write sourcemaps (defaults to true) |
71+
| `turbopackMinify` | Minify output code (fefaults to true in build mode and false in dev mode) |
72+
6973
## Examples
7074

7175
### Configuring webpack loaders
@@ -82,13 +86,11 @@ Here is an example below using the [`@svgr/webpack`](https://www.npmjs.com/packa
8286

8387
```js filename="next.config.js"
8488
module.exports = {
85-
experimental: {
86-
turbo: {
87-
rules: {
88-
'*.svg': {
89-
loaders: ['@svgr/webpack'],
90-
as: '*.js',
91-
},
89+
turbopack: {
90+
rules: {
91+
'*.svg': {
92+
loaders: ['@svgr/webpack'],
93+
as: '*.js',
9294
},
9395
},
9496
},
@@ -105,12 +107,10 @@ To configure resolve aliases, map imported patterns to their new destination in
105107

106108
```js filename="next.config.js"
107109
module.exports = {
108-
experimental: {
109-
turbo: {
110-
resolveAlias: {
111-
underscore: 'lodash',
112-
mocha: { browser: 'mocha/browser-entry.js' },
113-
},
110+
turbopack: {
111+
resolveAlias: {
112+
underscore: 'lodash',
113+
mocha: { browser: 'mocha/browser-entry.js' },
114114
},
115115
},
116116
}
@@ -128,18 +128,8 @@ To configure resolve extensions, use the `resolveExtensions` field in `next.conf
128128

129129
```js filename="next.config.js"
130130
module.exports = {
131-
experimental: {
132-
turbo: {
133-
resolveExtensions: [
134-
'.mdx',
135-
'.tsx',
136-
'.ts',
137-
'.jsx',
138-
'.js',
139-
'.mjs',
140-
'.json',
141-
],
142-
},
131+
turbopack: {
132+
resolveExtensions: ['.mdx', '.tsx', '.ts', '.jsx', '.js', '.mjs', '.json'],
143133
},
144134
}
145135
```
@@ -161,14 +151,15 @@ To configure the module IDs strategy, use the `moduleIds` field in `next.config.
161151

162152
```js filename="next.config.js"
163153
module.exports = {
164-
turbo: {
154+
turbopack: {
165155
moduleIds: 'deterministic',
166156
},
167157
}
168158
```
169159

170160
## Version History
171161

172-
| Version | Changes |
173-
| -------- | -------------------------------- |
174-
| `13.0.0` | `experimental.turbo` introduced. |
162+
| Version | Changes |
163+
| -------- | ----------------------------------------------- |
164+
| `15.3.0` | `experimental.turbo` is changed to `turbopack`. |
165+
| `13.0.0` | `experimental.turbo` introduced. |

Diff for: 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

Diff for: 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)