Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

15.1 docs: unstablePersistentCaching #73256

Closed
wants to merge 9 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 40 additions & 8 deletions docs/01-app/03-api-reference/05-config/01-next-config-js/turbo.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,16 @@ module.exports = nextConfig

The following options are available for the `turbo` configuration:

| Option | Description |
| ------------------- | ------------------------------------------------------------------------- |
| `rules` | List of unsupported webpack loaders to apply when running with Turbopack. |
| `resolveAlias` | Map aliased imports to modules to load in their place. |
| `resolveExtensions` | List of extensions to resolve when importing files. |
| `moduleIdStrategy` | Assign module IDs |
| `treeShaking` | Enable tree shaking for the turbopack dev server and build. |
| `memoryLimit` | A target memory limit for turbo, in bytes. |
| Option | Type | Description |
| --------------------------- | ----------------------------------------------- | -------------------------------------------------------------------------- |
| `moduleIdStrategy` | `'named'` or `'deterministic'` | The module ID strategy to use. |
| `minify` | `boolean` | Enable minification. Defaults to true in build mode and false in dev mode. |
| `resolveAlias` | `Record<string>` | Map aliased imports to modules to load in their place. |
| `resolveExtensions` | `string[]` | List of extensions to resolve when importing files. |
| `rules` | `Record<string, TurboRuleConfigItemOrShortcut>` | List of unsupported webpack loaders to apply when running with Turbopack. |
| `root` | `string` | The repo root directory. |
| `treeShaking` | `boolean` | Enable tree shaking for the turbopack dev server and build. |
| `unstablePersistentCaching` | `boolean` | Enable the persistent cache for Turbopack dev server and build. |

### Supported loaders

Expand All @@ -68,6 +70,36 @@ The following loaders have been tested to work with Turbopack's webpack loader i

## Examples

### Enabling Persistent Caching

Turbopack's Persistent Caching allows compilation work to persist across restarts of the development server or builds, reducing cold start times for all applications by caching previously compiled work, and only recompiling what has changed.

To enable persistent caching, set the `unstablePersistentCaching` option to `true` in `next.config.js`:

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

const nextConfig: NextConfig = {
experimental: {
turbo: {
unstablePersistentCaching: true,
},
},
}

export default nextConfig
```

```js filename="next.config.js" switcher
module.exports = {
experimental: {
turbo: {
unstablePersistentCaching: true,
},
},
}
```

### Configuring webpack loaders

If you need loader support beyond what's built in, many webpack loaders already work with Turbopack. There are currently some limitations:
Expand Down
2 changes: 1 addition & 1 deletion docs/01-app/03-api-reference/08-turbopack.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ To enable Turbopack, use the `--turbopack` flag when running the Next.js develop

### Supported features

Turbopack in Next.js requires zero-configuration for most users and can be extended for more advanced use cases. To learn more about the currently supported features for Turbopack, view the [API Reference](/docs/app/api-reference/config/next-config-js/turbo).
Turbopack in Next.js requires zero-configuration for most users and can be extended for more advanced use cases. To learn more about the currently supported features for Turbopack, view the `turbo` config option [API Reference](/docs/app/api-reference/config/next-config-js/turbo).

### Unsupported features

Expand Down
Loading