Skalman/UglifyJS-online

Most semicolons are not in the output, even though defaults are used (show semicolons)

Dean-NC opened this issue · 3 comments

function test() {
   console.log('z');
}

will output:

function test(){console.log("z")}

and

import Z1 from './module1.js';

function test() {
 console.log('z');
}

will output:

import Z1 from"./module1.js";function test(){console.log("z")}

You're misinterpreting the meaning of semicolons. From the documentation:

semicolons (default true) -- separate statements with semicolons. If you pass false then whenever possible we will use a newline instead of a semicolon, leading to more readable output of uglified code (size before gzip could be smaller; size after gzip insignificantly larger).

The option either outputs a semicolon or a newline. If neither is needed, neither will be output. Output for your second example with semicolons:false:

import Z1 from"./module1.js"
function test(){console.log("z")}

@Skalman OK, thanks for explaining it.

No worries 😄