新增特性时间轴 · Babel 中文文档

2025-11-15 13:26:39

Babel 7.19.0

blog post

Support for the Stage 3 version of the decorators proposal

Transform support for the duplicate named capturing groups Stage 3 proposal

/(?\d\d\d\d)-(?\d\d)|(?\d\d)-(?\d\d\d\d)/

Babel 7.18.0

blog post

TypeScript 4.7 support

Transform support for the Private destructuring Stage 2 proposal

class A {

#x = 2;

method() {

const { #x: x } = this;

}

}

No more need to manually include the regenerator-runtime helper when compiling generators

Babel 7.17.0

blog post

Support for the new version of the decorators Stage 2 proposal

class A {

@reactive #x = 2;

@logger

method() {

this.#x++;

}

}

Support for the RegExp set notation and properties of strings Stage 2 proposal

/[\p{RGI_Emoji}&&[\0-\uFFFF]]/v;

Parser support for the private destructuring Stage 2 proposal

class A {

#x = 2;

method() {

const { #x: x } = this;

}

}

Babel 7.16.0

blog post

Enable the class static blocks Stage 4 proposal by default

class A {

static {

initialize(A);

}

}

TypeScript 4.5 support

Support ESLint 8 in @babel/eslint-parser.

Babel 7.15.0

blog post

Enable parsing for the top-level await Stage 4 proposal by default

import db from "db";

await db.connect();

Enable the Private Brand Checks Stage 4 proposal by default

class A {

static { initialize(A); } // static block

#field;

is(obj) {

return #field in obj; // private brand check

}

}

Support the "Hack-style" pipeline operator Stage 2 proposal

const result = "World" |> `Hello, ${%}!` |> alert(%);

TypeScript 4.4 support

Babel 7.14.0

blog post

Enable the Class Fields,

Private Methods and Static Class Features Stage 4 proposals by default

Add the Private Brand Checks and Static Class Blocks proposals to @babel/preset-env's shippedProposals

class A {

static { initialize(A); } // static block

#field;

is(obj) {

return #field in obj; // private brand check

}

}

Support for the async do expressions proposal

let valP = async do {

2 + await computeIt();

};

Support for the importInterop: "node" option in @babel/plugin-transform-modules-commonjs, to aligh Babel with the Node.js behavior

TypeScript 4.3 support

Babel 7.13.0

博客公告

升级 targets 选项 (RFC)

粒度更小的编译器 assumptions (文档, RFC)

支持 Records 和 Tuples 提案

let rec = #{ x: 1 };

let tup = #[1, 2, 3];

支持 TypeScript 4.2

Babel 7.12.0

博客公告

支持 class static blocks 提案

class A {

static { initialize(A); }

}

支持 imports and exports string names 提案

let happy = "wooo!";

export { happy as "😃" };

解析器支持 Import Assertions 提案

import json from "./foo.json" assert { type: "json" };

支持 TypeScript 4.1

Babel 7.11.0

博客公告

默认支持 Logical Assignment 和

Numeric Separator 等 4 级提案

解析器支持 Decimal 提案

console.assert(0.1m + 0.2m === 0.3m);

TypeScript 4.0 support

@babel/eslint-parser

博客公告

Babel 7.10.0

博客公告

默认允许解析器支持 import.meta 等 4 级提案

支持 Ergonomic brand checks for Private Fields 提案

class Car {

#plate;

race(other) {

if (#plate in other) console.log("Racing against another car!");

}

}

babel-polyfills

仓库地址

Babel 7.9.0

博客公告

在 @babel/preset-env 中新增 bugfixes 选项, 以支持更灵活地解决游览器漏洞,而不是重新编译整个特性。

支持 TypeScript 3.8

支持 Flow declare 类字段。

自动支持全新的 JSX 运行环境

Babel 7.8.0

博客公告

默认支持 Optional Chaining 和

Nullish Coalescing 等 4 级提案

支持 .mjs 文件类型

Babel 7.7.0

博客公告

解析器支持 top-level await 提案

import db from "./database.js";

await db.connect();

在 @babel/parser 为早期错误添加错误恢复支持。

支持 .json and .cjs 文件类型

支持 TypeScript 3.7

Babel 7.6.0

博客公告

支持静态私有访问器,以及

static class features 提案的部分内容

class Dog {

static get #className() { return "Dog"; }

}

Babel 7.5.0

博客公告

支持 F# pipeline operator 提案

num |> add(2) |> double

支持 TypeScript namespace

Babel 7.4.0

博客公告

支持注入 core-js@3 polyfills

支持 Partial Application 提案

strings.map(parseInt(?));

支持静态私有方法,以及

static class features 提案的部分内容

class Dog {

static #register() { /* ... */ }

}

支持 TypeScript 3.4

Babel 7.3.0

博客公告

支持实例私有访问,以及

private methods 提案的部分内容

class Dog {

get #randomId() { return Math.random(); }

}

支持 smart pipeline operator 提案

num |> add(2, #) |> double

在正则表达式中支持

named capturing groups

str.match({String.raw`/^(?\d{4})-(?\d{2})-(?\d{2})$/`})

支持 TypeScript 3.2 和 2.9

Babel 7.2.0

博客公告

支持实例私有方法,以及 private methods 提案的部分内容

class Dog {

#bark() { console.log("Mew!") }

}

Babel 7.1.0

博客公告

支持 decorators 提案, 并于 2018 年 9 月指明

class Person {

@autoIncrement age;

}

支持静态私有字段,以及 static class features 提案的部分内容

class Person {

static #classId = 3;

}

Babel 7

博客公告

此处列出了许多变化,因为它们是两年内将要发布的内容。

放弃对已不再维护的 Node 版本(0.10, 0.12, 4, 5)的支持

切换到作用域包 (从 babel-core 变为 @babel/core)

移除年度预设 (@babel/preset-es2015) 以及阶段预设 (@babel/preset-stage-0) (博客公告).

在某些情况下添加对 "pure" (/*#__PURE__*/ )注释的支持。(后来实现为 @babel/helper-annotate-as-pure)

添加项目级的 babel.config.js 配置文件 (文档) 以及 overrides 配置选项

对 @babel/preset-env 补充 "useBuiltIns: "usage" 选项

通过 @babel/preset-typescript 支持 TypeScript

支持 JSX 语法 <>

支持一系列 TC39 提案:

Unicode Property Regex

JSON Superset

new.target

Class Private Instance Fields (class A { #b = 2 })

Optional Catch Binding try { throw 0 } catch { do() }

BigInt (syntax only)

import.meta (syntax only) (import.meta.url)

Numeric Separators (1_000)

function.sent

Optional Chaining (a?.b)

Logical Assignment Operators (a &&= b; a ||= b)

Nullish Coalescing Operator (a ?? b)

Pipeline Operator (a |> b)

Throw Expressions (() => throw new Error("a"))

淘客软件基地:专业平台有保障,以高标准规范服务赢得用户信赖
阿根廷提前晋级2026世界杯 锁定前六席位