swc gets ability to detect required transforms and polyfills based on target. Target includes browser with specific version ( "chrome 49" ), or complex query ( "last 2 versions" ).

{ "env" : { "mode" : "entry" , "targets" : "last 2 versions" , "coreJs" : 3 } }

would enable transformations and inject polyfills to run code on last 2 versions of browsers and node js.

If you want to use existing browserslist config, you can just omit targets .

{ "env" : { "mode" : "entry" , "coreJs" : 3 } }

This will follow browserslist queries of the project.

See docs for more information.

parser bugfixes

span of from clauses (#535)

Span of "test"; in

export * from "test" ;

incorrectly contained the span of ; . swc can now parses it correctly.

Some users uses swc's parser within their rust project, and reported an error.

export declare function test ( ): string ;

Note that this had no effects on users who use swc via javascript api.

test( ); test( 123 ); test( 123 ); test( 123 ); test( 123 , 456 ); test( 123 , 456 );

is now compiled as

test(); test( 123 ); test( 123 ); test( 123 ); test( 123 , 456 ); test( 123 , 456 );

Originally, it was compiled as