Skip to content

Commit

Permalink
Add module transpilation docs (#44518)
Browse files Browse the repository at this point in the history
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).
  • Loading branch information
chibicode authored Jan 3, 2023
1 parent efcec4c commit b6530bb
Showing 1 changed file with 20 additions and 8 deletions.
28 changes: 20 additions & 8 deletions docs/advanced-features/compiler.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ description: Learn about the Next.js Compiler, written in Rust, which transforms
<details open>
<summary><b>Version History</b></summary>

| Version | Changes |
| --------- | ---------------------------------------------------------------------------------------------------------------------------------- |
| `v13.1.0` | Modularize Imports [stable](https://nextjs.org/blog/next-13-1#import-resolution-for-smaller-bundles). |
| `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.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.0.0` | Next.js Compiler [introduced](https://nextjs.org/blog/next-12). |
| Version | Changes |
| --------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `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. |
| `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.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). |

</details>

Expand Down Expand Up @@ -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

Allows to modularize imports, similar to [babel-plugin-transform-imports](https://www.npmjs.com/package/babel-plugin-transform-imports).
Expand Down

0 comments on commit b6530bb

Please sign in to comment.