this post was submitted on 25 Oct 2020
1 points (100.0% liked)
JavaScript community
878 readers
4 users here now
A community about JavaScript, the ECMAScript standard, and programs that make use of JS such as Node.js.
founded 5 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
When producing a single line file, the minifier doesn't need to insert a semicolon after every statement. A decent minifier will only insert semicolons where absolutely necessary, omitting them in places where the parser would automatically insert them anyway. See this blog post that talks about automatic semicolon insertion.
Take for example the
client.js
file on this site (lemmy.ml). Minified to a single line and with the ~5400 semicolons left in, it weighs roughly 1.37Mb.If we prettify it (it comes to ~56000 lines for me), remove all indentation and delete all semicolons, the weight increases to 1.53Mb with LF and 1.58Mb with CRLF.