Unverified Commit 82196b8e authored by Maia Teegarden's avatar Maia Teegarden Committed by GitHub

Fix docs for configuring Turbopack (#71755)

### 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
parent f06906af
...@@ -11,9 +11,11 @@ The `turbo` option lets you customize [Turbopack](/docs/architecture/turbopack) ...@@ -11,9 +11,11 @@ The `turbo` option lets you customize [Turbopack](/docs/architecture/turbopack)
import type { NextConfig } from 'next' import type { NextConfig } from 'next'
const nextConfig: NextConfig = { const nextConfig: NextConfig = {
experimental: {
turbo: { turbo: {
// ... // ...
}, },
},
} }
export default nextConfig export default nextConfig
...@@ -22,9 +24,11 @@ export default nextConfig ...@@ -22,9 +24,11 @@ export default nextConfig
```js filename="next.config.js" switcher ```js filename="next.config.js" switcher
/** @type {import('next').NextConfig} */ /** @type {import('next').NextConfig} */
const nextConfig = { const nextConfig = {
experimental: {
turbo: { turbo: {
// ... // ...
}, },
},
} }
module.exports = nextConfig module.exports = nextConfig
...@@ -76,6 +80,7 @@ To configure loaders, add the names of the loaders you've installed and any opti ...@@ -76,6 +80,7 @@ To configure loaders, add the names of the loaders you've installed and any opti
```js filename="next.config.js" ```js filename="next.config.js"
module.exports = { module.exports = {
experimental: {
turbo: { turbo: {
rules: { rules: {
'*.svg': { '*.svg': {
...@@ -84,6 +89,7 @@ module.exports = { ...@@ -84,6 +89,7 @@ module.exports = {
}, },
}, },
}, },
},
} }
``` ```
...@@ -97,12 +103,14 @@ To configure resolve aliases, map imported patterns to their new destination in ...@@ -97,12 +103,14 @@ To configure resolve aliases, map imported patterns to their new destination in
```js filename="next.config.js" ```js filename="next.config.js"
module.exports = { module.exports = {
experimental: {
turbo: { turbo: {
resolveAlias: { resolveAlias: {
underscore: 'lodash', underscore: 'lodash',
mocha: { browser: 'mocha/browser-entry.js' }, mocha: { browser: 'mocha/browser-entry.js' },
}, },
}, },
},
} }
``` ```
...@@ -118,8 +126,18 @@ To configure resolve extensions, use the `resolveExtensions` field in `next.conf ...@@ -118,8 +126,18 @@ To configure resolve extensions, use the `resolveExtensions` field in `next.conf
```js filename="next.config.js" ```js filename="next.config.js"
module.exports = { module.exports = {
experimental: {
turbo: { turbo: {
resolveExtensions: ['.mdx', '.tsx', '.ts', '.jsx', '.js', '.mjs', '.json'], resolveExtensions: [
'.mdx',
'.tsx',
'.ts',
'.jsx',
'.js',
'.mjs',
'.json',
],
},
}, },
} }
``` ```
...@@ -141,15 +159,16 @@ To configure the module IDs strategy, use the `moduleIdStrategy` field in `next. ...@@ -141,15 +159,16 @@ To configure the module IDs strategy, use the `moduleIdStrategy` field in `next.
```js filename="next.config.js" ```js filename="next.config.js"
module.exports = { module.exports = {
experimental: {
turbo: { turbo: {
moduleIdStrategy: 'deterministic', moduleIdStrategy: 'deterministic',
}, },
},
} }
``` ```
## Version History ## Version History
| Version | Changes | | Version | Changes |
| ----------- | ------------------------------------------------- | | -------- | -------------------------------- |
| `15.0.0-RC` | `turbo` is now stable and no longer experimental. |
| `13.0.0` | `experimental.turbo` introduced. | | `13.0.0` | `experimental.turbo` introduced. |
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment