

This transform uses handlebars to template the replacement import path in the transform field. To become: import MyModule from 'my-library/MyModule' import App from 'my-library/components/App' import Header from 'my-library/components/App/Header' import Footer from 'my-library/components/App/Footer' exports = from 'my-library/components/App' We're working to port babel-plugin-styled-components to the Next.js Compiler.įirst, update to the latest version of Next.js: npm install Then, update your file: module.


Extensibility: SWC can be used as a Crate inside Next.js, without having to fork the library or workaround design constraints.We chose to build on SWC for a few reasons: Running those transformations happens through higher-level tools like Next.js. It's something you can call to perform code transformations (either built-in or custom). SWC can be used for compilation, minification, bundling, and more – and is designed to be extended. SWC is an extensible Rust-based platform for the next generation of fast developer tools. If you have an existing Babel configuration or are using unsupported features, your application will opt-out of the Next.js Compiler and continue using Babel.

This replaces Babel for individual files and Terser for minifying output bundles.Ĭompilation using the Next.js Compiler is 17x faster than Babel and enabled by default since Next.js version 12. The Next.js Compiler, written in Rust using SWC, allows Next.js to transform and minify your JavaScript code for production. Reporter.Added support for Styled Components, Jest, Relay, Remove React Properties, Legacy Decorators, Remove Console, and jsxImportSource.
