Also, Babel now ships with TypeScript support. You parse type syntax using
Other capabilities in Babel 7 include:
babel-upgradetool, for automatically dealing with breaking changes. The tool has dependencies in
babelrcconfig. The Babel team recommends running it directly on a Git repo with
npx babel-upgrade, or you can installed it directly with
npm i babel-upgrade –g.
- Selective configurations are enabled via
overrides, for specifying different configs per glob.
- Changes have been made to the
looseoption of some plugins, while new options have been added to others. But using these options opts the developer into non-spec-compliant behavior. This can become an issue when switching off of compiling to use the syntax natively.
- Automatic polyfilling is featured, in an experimental fashion. Polyfills are needed for features such as
symbolin environments that do not support them. This is important when differentiating between what Babel does as a compiler vs. a polyfill.
calleroption has been added to
@babel/coreso tools can pass metadata to presets and plugins.
Babel 7 does break several existing capabilities:
- It drops support for unmaintained Node Versions 0.10, 0.12, 4, 5.
- It introduces the
@babel/corefor certain user-facing packages, such as
- It moves to the
@babelnamespace by switching to “scoped” packages. This helps differentiate official packages so
- JSX Fragment support is available, as it has been since beta 31.
Planned features for future versions include:
- Plugin ordering.
- Better validation and error messages.
- Asynchronous use of Babel.