15 ms·
The common case of "bundling" is just concatenating files, which works fine if people add their damned semicolons. To quote the author: "not using any semicolo
by galacticpony2 9y ago
The common case of "bundling" is just concatenating files, which works fine if people add their damned semicolons.
To quote the author: "not using any semicolons at all is a very popular trend in JS these days, so it is very possible this problem might happen in the real world"
This is the crux of the problem. Javascript programmers often follow trends, not sane practice. Looking at the code, for some reason there's a semi-colon before "require" invocations as well.
I don't even know what to say, at this point. Everyone is fired.
- demarq 9y ago> The common case of "bundling" is just concatenating files, which works fine if people add their damned semicolons. bundling is not just concatenation, and certainly not in the "common" case. > "not using any semicolons at all is a very popular trend in JS these days > Javascript programmers often follow trends, not sane practice Please have a look all the popular libraries and frameworks and their codebases[1], then tell me you still think your assessment of the Javascript community is at all fair. [1]https://www.javascripting.com/ https://www.javascripting.com/
- galacticpony2 9y ago> bundling is not just concatenation, and certainly not in the "common" case. Fair enough, the common case is minification and concatenation. Or what else is it? The problem with the semicolon remains. > Please have a look all the popular libraries and frameworks and their codebases[1], then tell me you still think your assessment of the Javascript community is at all fair. Yes, it is. https://hackernoon.com/how-it-feels-to-learn-javascript-in-2016-d3a717dd577f https://hackernoon.com/how-it-feels-to-learn-javascript-in-2...
- dozzie 9y ago> Fair enough, the common case is minification and concatenation. Or what else is it? The problem with the semicolon remains. If it is minification, then you already have a tool that process the code. The tool can easily just add the missing colon before concatenation.
- galacticpony2 9y agoThe tool that does the minification isn't necessarily the same tool that does the concatenation. Here's a very lengthy discussion on how the very popular minifier UglifyJS (version 1) originally removed trailing semicolons, causing this exact problem: https://web.archive.org/web/20130319222210/https://github.com/mishoo/UglifyJS/issues/126 https://web.archive.org/web/20130319222210/https://github.co... In the real world, it's irrelevant what tools could be reasonably expected to do. What matters is what they actually do. Expecting your tools to insert semicolons for you is the path that leads to peril.