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,8 +11,10 @@ The `turbo` option lets you customize [Turbopack](/docs/architecture/turbopack) ...@@ -11,8 +11,10 @@ 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 = {
turbo: { experimental: {
// ... turbo: {
// ...
},
}, },
} }
...@@ -22,8 +24,10 @@ export default nextConfig ...@@ -22,8 +24,10 @@ 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 = {
turbo: { experimental: {
// ... turbo: {
// ...
},
}, },
} }
...@@ -76,11 +80,13 @@ To configure loaders, add the names of the loaders you've installed and any opti ...@@ -76,11 +80,13 @@ 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 = {
turbo: { experimental: {
rules: { turbo: {
'*.svg': { rules: {
loaders: ['@svgr/webpack'], '*.svg': {
as: '*.js', loaders: ['@svgr/webpack'],
as: '*.js',
},
}, },
}, },
}, },
...@@ -97,10 +103,12 @@ To configure resolve aliases, map imported patterns to their new destination in ...@@ -97,10 +103,12 @@ 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 = {
turbo: { experimental: {
resolveAlias: { turbo: {
underscore: 'lodash', resolveAlias: {
mocha: { browser: 'mocha/browser-entry.js' }, underscore: 'lodash',
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 = {
turbo: { experimental: {
resolveExtensions: ['.mdx', '.tsx', '.ts', '.jsx', '.js', '.mjs', '.json'], turbo: {
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 = {
turbo: { experimental: {
moduleIdStrategy: 'deterministic', turbo: {
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