Skip to main content

Changelog: swc v1.2.77

· 2 min read

To see full list of patches, please visit https://github.com/swc-project/swc/milestone/178?closed=1

Improvements#

mimalloc#

Now swc uses mimalloc instead of jemalloc.

Implemented by @Brooooooklyn and by #2068.

Better error handling (#2035)#

Due to the some initial misdesign, handling errors from swc was inconvinient. You can now use the exception thrown from the swc node apis.

Implemented by #2065.

bundler: paths support#

options.jsc.paths in spack.config.js is respected when resolving modules.

Implemented by @tmpfs and by #2054.

Bugfixes#

Type definition of ImportDeclaration (#2059)#

Previsouly typescript type definition did not contain the field typeOnly.

Fixed by #2067.

Optional chaining (#2063)#

Previously swc miscompiled optional chaining in some cases.

Fixed by #2067.

class-validator (#1362)#

Previously using class-validator with swc resulted in an error if decorator metadata is enabled but reflect-metadata is not imported.

Fixed by #2055.

async generator (#1918)#

Previosuly swc miscompiled code like

let resolve;let promise = new Promise((r) => (resolve = r));let iterable = {  [Symbol.asyncIterator]() {    return {      next() {        return promise;      },    };  },};
(async () => {  for await (let value of iterable) {    console.log(value);  }})();
(async function () {  resolve({ value: 0, done: false });  promise = new Promise((r) => (resolve = r));
  await null;  resolve({ value: 1, done: false });  promise = new Promise((r) => (resolve = r));
  resolve({ value: undefined, done: true });})();

This fix does not affect many users.

Fixed by #2055.

minifier bugs (#2051, #2011)#

While mangling, shorthand properties are now handled corrctly, and some self-reassigning functions from swc or babel is now treated correctly.

Fixed by #2052