Changelog: swc v1.2.42

Bugfixes#

bundler: Handle of export * correctly. (#1264)#

Previously the bundler of [swc][] did not exclude default while handling export *. This is wrong and it's fixed. As a result, you can now export default while using export * from './foo'

export { default } from "./foo";
export * from "./foo";

The code above now works.

bundler: Fix statement ordering. (#1264)#

Order of statements are now preserved. Previously, the bundler only considers about dependancy, but it resulted in some bugs so I patched it to preserve original order.

bundler: Group statements from same module. (#1264)#

While flattening all statements, the bundler now prefers statements from same module. It will help debugging the bundle, as related statements live at simillar place.

fixer: Handle assignmnet in new exprssion correctly. (#1264)#

Previously [swc][] errornously removed parenthesis from const a = new (a = b);. It resulted in const a = new a = b;, which has different meaning.

fixer: Handle comma expression in new exprssion correctly. (#1264)#

Previously [swc][] errornously removed parenthesis from const a = new (a, b);. It resulted in const a = new a, b; , which has different meaning. This is now fixed.

bundler: Prevent duplicate variable. (#1296)#

This bug occurrs when export * as foo is mixed with export * from '' more than three times, and with import. It's now fixed and bundler bundles it correctly.

bundler: Handle keywords. (#1296)#

EcmaScript allows using keywords as an identifier in some places. As the bundler flatten statements, it made a variable named instanceof when it met export { foo as instanceof }.

But this is a bug and it's now renamed to something other.

dce: Prevent tags in tagged template literals. (#1296)#

The dce was too aggresive and it removed tagged template literals. It now preserves as tagged template literals can have side effect.

Note:

If you are using some old target, you are not affected.

dce: Handle throw statement correctly. (#1296)#

Again, it errornously removed something used by throw statement. I patched it to mark argument as used correctly.