Skip to main content

Changelog: swc v1.2.78

· 2 min read

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

Improvements#

Performance#

  • Now swc uses faster hashing algorithms in various places. ((#2073))

Bugfixes#

Mangling of private properties (#2086)#

function as a property name (#2075)#

Previously, swc fails to parse if jsx is enabled and function is used as a property key in jsx experssions.

It broke code like

const x = <div onclick={(e) => ({ function: 123 })}></div>;

or

const x = <div onclick={{ function: 123 }}></div>;

Fixed by #2076.

Type definitions (#1947)#

Typings for swc api is improved.

Fixed by #2077.

bundler: Stack overflow (#1963)#

Previously bundler wrongly recursed into some functions and it resulted in a stack overflow.

Fixed by #2080

minifier bugs (#2072, #2078)#

Previsouly the minifier could break some valid programs, like

let rerenderQueue = [1];let queue;
while (rerenderQueue.length > 0) {  queue = rerenderQueue.sort();  rerenderQueue = [];  queue.forEach((c) => console.log(c));}

(#2708)

or

function cost(oldItem, newItem) {  if (newItem.val === oldItem.val) {    return 0;  }  if (typeof oldItem.val === "object" && typeof newItem.val === "object") {    if (oldItem.key === undefined || newItem.key === undefined) {      return 1;    }    if (oldItem.key === newItem.key) {      return 0;    }  }  return 1;}

(#2072)

Fixed by #2058

inline_globals (#1294)#

Previsouly, __DEBUG__ in

var __DEBUG__ = "hi";console.log(__DEBUG__);

was replaced with the value declared in .swcrc, but it is wrong because local declarations should have higher priorities than global config.

Fixed by #2058

bundler: browser#

The bundler of swc now supports using object for browser in package.json.

Fixed by @tmpfs and by #2060