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:

package.json
{
  "browserslist": [
    "last 1 version",
    "> 1%",
    "not dead"
  ]
}

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 alpha 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.

Last updated on 2022-10-31T16:55:37.000Z