JavaScript
ECMAScript Support
Turbopack uses SWC to bundle JavaScript and TypeScript files. So, we match SWC's support for ECMAScript versions - anything that SWC supports, Turbopack will support.
This means that by default we support all syntax in ESNext.
Browserslist
Browserslist has become an industry standard for defining which browsers you plan to target. To make use of it, you can add a browserslist
field to your package.json
:
Turbopack supports Browserslist out-of-the-box. We pass the information we find in your package.json
to SWC, which handles browserslist
support for us.
This means you can feel comfortable using Turbopack to target legacy browsers, or deciding to only ship code to modern browsers.
Turbopack is available in beta preview with a dev server, which uses a pre-set minimal browserslist to minimize transformation during development. In a future release, Turbopack will build apps for production targeting your defined browserslist.
Babel
Babel allows you to add custom transformations to your code to provide custom syntax, including support for early language proposals.
Babel plugins are currently not supported on Turbopack. In our default configuration, we don't use Babel to compile JavaScript or TypeScript code.
In the future, Babel support will be provided via plugins.