Unverified Commit b6530bb3 authored by Shu Uesugi's avatar Shu Uesugi Committed by GitHub

Add module transpilation docs (#44518)

Module transpilation docs were missing from the [compilers documentation](https://nextjs.org/docs/advanced-features/compiler). The text was mostly copied from the [Beta docs](https://beta.nextjs.org/docs/api-reference/next.config.js#transpilepackages).
parent efcec4c1
...@@ -7,14 +7,14 @@ description: Learn about the Next.js Compiler, written in Rust, which transforms ...@@ -7,14 +7,14 @@ description: Learn about the Next.js Compiler, written in Rust, which transforms
<details open> <details open>
<summary><b>Version History</b></summary> <summary><b>Version History</b></summary>
| Version | Changes | | Version | Changes |
| --------- | ---------------------------------------------------------------------------------------------------------------------------------- | | --------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `v13.1.0` | Modularize Imports [stable](https://nextjs.org/blog/next-13-1#import-resolution-for-smaller-bundles). | | `v13.1.0` | [Module Transpilation](https://nextjs.org/blog/next-13-1#built-in-module-transpilation-stable) and [Modularize Imports](https://nextjs.org/blog/next-13-1#import-resolution-for-smaller-bundles) stable. |
| `v13.0.0` | SWC Minifier enabled by default. | | `v13.0.0` | SWC Minifier enabled by default. |
| `v12.3.0` | SWC Minifier [stable](https://nextjs.org/blog/next-12-3#swc-minifier-stable). | | `v12.3.0` | SWC Minifier [stable](https://nextjs.org/blog/next-12-3#swc-minifier-stable). |
| `v12.2.0` | [SWC Plugins](#swc-plugins-Experimental) experimental support added. | | `v12.2.0` | [SWC Plugins](#swc-plugins-Experimental) experimental support added. |
| `v12.1.0` | Added support for Styled Components, Jest, Relay, Remove React Properties, Legacy Decorators, Remove Console, and jsxImportSource. | | `v12.1.0` | Added support for Styled Components, Jest, Relay, Remove React Properties, Legacy Decorators, Remove Console, and jsxImportSource. |
| `v12.0.0` | Next.js Compiler [introduced](https://nextjs.org/blog/next-12). | | `v12.0.0` | Next.js Compiler [introduced](https://nextjs.org/blog/next-12). |
</details> </details>
...@@ -265,6 +265,18 @@ module.exports = { ...@@ -265,6 +265,18 @@ module.exports = {
} }
``` ```
### Module Transpilation
Next.js can automatically transpile and bundle dependencies from local packages (like monorepos) or from external dependencies (`node_modules`). This replaces the `next-transpile-modules` package.
```js
// next.config.js
module.exports = {
transpilePackages: ['@acme/ui', 'lodash-es'],
}
```
### Modularize Imports ### Modularize Imports
Allows to modularize imports, similar to [babel-plugin-transform-imports](https://www.npmjs.com/package/babel-plugin-transform-imports). Allows to modularize imports, similar to [babel-plugin-transform-imports](https://www.npmjs.com/package/babel-plugin-transform-imports).
......
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