Skip to main content

· 6 min read

此版本默认支持解析顶级 await(第 4 阶段的 五月 会议)以及转换对私有字段的更人性化的 brand checks(第 4 阶段的 七月 会议)。现在还支持 Hack-style 管道操作符。我们也改进了对 TypeScript 的支持,实现了对 const 枚举和命名空间别名的转换支持,并且我们扩展了通过 React.createContext() 创建的 React 组件添加 .displayName 的启发式方法(#13501)。

我们还引入了一个新的编译器假设,noIncompleteNsImportDetection,在将 ECMAScript 模块编译到 CommonJS 时产生更小的输出,而不必担心模块周期导致的部分初始化的命名空间导入。

此外,你现在可以指定 Rhino 作为编译器目标。

你可以 在 GitHub 阅读完整的更新日志。

· 5 min read

Babel 7.14.0 is out!

This release enables class fields and private methods by default (they were promoted to Stage 4 during the recent April TC39 meeting!) and adds brand checks for private fields and static class blocks to @babel/preset-env's shippedProposals option.

We added support for Stage 1 async do expressions (using @babel/plugin-proposal-async-do-expressions), which extends the Stage 1 do expression proposal.

Thanks to Sosuke Suzuki and Pig Fang, Babel can now handle TypeScript 4.3 features. @babel/parser also has a new option to correctly parse TypeScript declaration files.

Finally, we introduced a new importInterop: node option to make it easier to produce dual modules by compiling ECMAScript imports to CommonJS that follow Node.js semantics.

You can read the whole changelog on GitHub.

· 7 min read

We just published Babel 7.13.0, the first minor release of 2021!

This release includes some important features to @babel/core: a targets option (similar to @babel/preset-env's one) that can be shared across different plugins, an assumptions option to precisely tune your configuration to produce a smaller compilation output, and support for plugins and presets written using native ECMAScript modules.

Babel now supports transforming the Records and Tuples ECMAScript proposal, which brings immutable data structures and structural equality to JavaScript, and parsing the Module Blocks proposal.

Additionally, we added support for some new Flow and TypeScript features.

You can read the full changelog on GitHub.

· 4 min read

We just published a new minor version of Babel!

This release includes support for the new TypeScript 4.1 beta features: template literal types and key remapping in mapped types.

Additionally, we implemented two new ECMAScript proposals: class static blocks and imports and exports with string names.

Lastly, we renamed @babel/plugin-syntax-module-attributes (and the corresponding parser plugin moduleAttributes) to @babel/plugin-syntax-import-assertions (and importAssertions), to match the recent proposal updates. The old plugin will work until Babel 8, but it's deprecated now.

You can read the whole changelog on GitHub.

· 5 min read

We just released a new minor version of Babel!

This 7.11 release includes:

  • preset-env support for Logical Assignments (??=), Numeric Separators (1_2) and Namespace re-exports (export * as ns from ...)
  • TypeScript 4.0 support
  • Parser support for the Stage-1 Decimal proposal (7.11m)
  • An environment flag to print the resolved Babel configuration for a given file (BABEL_SHOW_CONFIG_FOR)

In addition to this, we are now releasing the successor of babel-eslint: @babel/eslint-parser!

You can read the whole changelog on GitHub.

· 9 min read

We just released a new minor version of Babel!

This 7.10 release includes:

  • Full support for the new Stage 1 proposal, #prop in obj checks for private fields proposal.
  • @babel/preset-env now compiles ES2015-style Unicode escapes (\u{Babe1}) to the equivalent legacy syntax (\uDAAA\uDFE1).
  • Two improvements to the Optional Chaining operator (?.)
  • Parser support for the new Stage 1 Module Attributes proposal (import a from "./a.json" with type: "json").
  • Better tree-shaking support for React code (i.e. React.memo)!
  • Setting up RFCs repo and GitHub Discussions pages!

You can read the whole changelog on GitHub.

· 9 min read

While preparing the Babel 8.0.0 release (in the next months), we just finished working on a new minor release which includes updates related to @babel/preset-env, TypeScript 3.8, Flow, and JSX!

A few months ago, Jason Miller started working on @babel/preset-modules: an experiment to greatly reduce bundle sizes when using the module/nomodule pattern. We are excited to announce that its functionality has now been merged into @babel/preset-env! This means that its optimizations can be applied to all preset-env targets values, without a separate preset.

Note: These optimizations will be enabled by default in Babel 8. They can be manually enabled in Babel 7.9 by passing in the option { bugfixes: true } to preset-env.

This release also has full support for TypeScript 3.8, which introduced explicit type-only imports and exports (i.e. export type { foo }), and for Flow 0.120, which introduced the declare modifier for class fields (i.e. class C { declare foo: string }).

We also worked with the React team to provide a new JSX transform, which will make it possible for React and React-like libraries to further optimize the creation of JSX elements with the addition of the jsx function vs. React.createElement.

Lastly, @babel/parser now supports an additional ECMAScript proposal: Record & Tuple. Please note that this is only parser support, and the transforms are still being worked on.

You can read the whole changelog on GitHub.

· 8 min read

This is the first release of the year! 🎉

Babel 7.8.0 supports the new ECMAScript 2020 features by default: you don't need to enable individual plugins for nullish coalescing (??), optional chaining (?.) and dynamic import() anymore with preset-env.

We also finished aligning our different configuration files with the formats natively supported by Node.js, a process that we started in the 7.7.0 release.

Lastly, Babel's CLI now supports two new options: --out-file-extension and --copy-ignored.

You can read the whole changelog on GitHub.