Unverified Commit 25fe6f6f authored by Joseph's avatar Joseph Committed by GitHub

docs: document default turbopack.resolveExtensions (#98627)

Fixes: #98609

Editor note: Ensure this lands well into
https://github.com/vercel/next.js/pull/98407 too
parent b421cade
......@@ -355,12 +355,23 @@ To configure resolve extensions, use the `resolveExtensions` field in `next.conf
```js filename="next.config.js"
module.exports = {
turbopack: {
resolveExtensions: ['.mdx', '.tsx', '.ts', '.jsx', '.js', '.mjs', '.json'],
resolveExtensions: [
'.mdx',
'.tsx',
'.ts',
'.jsx',
'.js',
'.mjs',
'.node',
'.json',
],
},
}
```
This overwrites the original resolve extensions with the provided list. Make sure to include the default extensions.
This overwrites the default resolve extensions with the provided list, so include every extension you still need. The defaults are `.tsx`, `.ts`, `.jsx`, `.js`, `.mjs`, and `.json`, and server-side resolution adds `.node` for native modules. Listing `.node` on the client is harmless, so a single list can cover both.
> **Good to know**: This applies to your own source files. Imports resolved inside `node_modules` keep their own extension list and are not affected by this option.
For more information and guidance for how to migrate your app to Turbopack from webpack, see [Turbopack's documentation on webpack compatibility](https://turbo.build/pack/docs/migrating-from-webpack).
......
......@@ -487,7 +487,16 @@ module.exports = {
resolveAlias: {
underscore: 'lodash',
},
resolveExtensions: ['.mdx', '.tsx', '.ts', '.jsx', '.js', '.json'],
resolveExtensions: [
'.mdx',
'.tsx',
'.ts',
'.jsx',
'.js',
'.mjs',
'.node',
'.json',
],
},
}
```
......
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