Changelog: swc v1.1.20


Smaller runtime dependency (#631)#

swc now imports regenerator-runtime instead of @babel/runtime/regenerator. This is not a breaking change because @babel/runtime depends on regenerator-runtime.

From now on, you can remove @babel/runtime from dependencies.

Better error message (#650)#

Instead of showing require failed, swc emits proper error message (swc: You have to install browserslist to use env) to stderr.

TypeScript privatge fields (#642)#

TypeScript 3.8 added the concept of private fields. As swc had private field support for ecmascript, adding support for typescript was easy.

class Person {
#name: string
constructor(name: string) {
this.#name = name;
greet() {
console.log(`Hello, my name is ${this.#name}!`);
let jeremy = new Person("Jeremy Bearimy");
// ~~~~~
// Property '#name' is not accessible outside class 'Person'
// because it has a private identifier.

TypeScript: export namespace from (#647)#

TypeScript 3.8 allows code like

export * as utilities from "./utilities.js";

As it's official typescript syntax, export * as namespace from 'foo' does not require changing any config.


Escpaes in template literals (#652)#

Previously, codes like

`\x1b[33m Yellow \x1b[0m`;

were broken by swc. swc handles escapes in template literals correctly.

TypeScript imports (#641)#

swc strips out type-only imports correctly.