Skip to content

Commit

Permalink
Fix docs for configuring Turbopack (#71755)
Browse files Browse the repository at this point in the history
### What?
Fixes code examples for configuring Turbopack. Turbopack Dev is stable,
but we're keeping the configuration options under `experimental` until
Turbopack Build is stable as well. Most of these options will not
change, but we didn't want a combination of experimental and stable
options.


Closes PACK-3324
  • Loading branch information
padmaia authored Oct 23, 2024
1 parent f06906a commit 82196b8
Showing 1 changed file with 40 additions and 21 deletions.
61 changes: 40 additions & 21 deletions docs/02-app/02-api-reference/05-next-config-js/turbo.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ The `turbo` option lets you customize [Turbopack](/docs/architecture/turbopack)
import type { NextConfig } from 'next'

const nextConfig: NextConfig = {
turbo: {
// ...
experimental: {
turbo: {
// ...
},
},
}

Expand All @@ -22,8 +24,10 @@ export default nextConfig
```js filename="next.config.js" switcher
/** @type {import('next').NextConfig} */
const nextConfig = {
turbo: {
// ...
experimental: {
turbo: {
// ...
},
},
}

Expand Down Expand Up @@ -76,11 +80,13 @@ To configure loaders, add the names of the loaders you've installed and any opti

```js filename="next.config.js"
module.exports = {
turbo: {
rules: {
'*.svg': {
loaders: ['@svgr/webpack'],
as: '*.js',
experimental: {
turbo: {
rules: {
'*.svg': {
loaders: ['@svgr/webpack'],
as: '*.js',
},
},
},
},
Expand All @@ -97,10 +103,12 @@ To configure resolve aliases, map imported patterns to their new destination in

```js filename="next.config.js"
module.exports = {
turbo: {
resolveAlias: {
underscore: 'lodash',
mocha: { browser: 'mocha/browser-entry.js' },
experimental: {
turbo: {
resolveAlias: {
underscore: 'lodash',
mocha: { browser: 'mocha/browser-entry.js' },
},
},
},
}
Expand All @@ -118,8 +126,18 @@ To configure resolve extensions, use the `resolveExtensions` field in `next.conf

```js filename="next.config.js"
module.exports = {
turbo: {
resolveExtensions: ['.mdx', '.tsx', '.ts', '.jsx', '.js', '.mjs', '.json'],
experimental: {
turbo: {
resolveExtensions: [
'.mdx',
'.tsx',
'.ts',
'.jsx',
'.js',
'.mjs',
'.json',
],
},
},
}
```
Expand All @@ -141,15 +159,16 @@ To configure the module IDs strategy, use the `moduleIdStrategy` field in `next.

```js filename="next.config.js"
module.exports = {
turbo: {
moduleIdStrategy: 'deterministic',
experimental: {
turbo: {
moduleIdStrategy: 'deterministic',
},
},
}
```

## Version History

| Version | Changes |
| ----------- | ------------------------------------------------- |
| `15.0.0-RC` | `turbo` is now stable and no longer experimental. |
| `13.0.0` | `experimental.turbo` introduced. |
| Version | Changes |
| -------- | -------------------------------- |
| `13.0.0` | `experimental.turbo` introduced. |

0 comments on commit 82196b8

Please sign in to comment.