history.js icon indicating copy to clipboard operation
history.js copied to clipboard

Script should end with ;

Open bubach opened this issue 10 years ago • 3 comments

The entire minified script should always end with a ";" - caused me unbelievable pain when trying to combine all my JS output into one file. Loads fine by itself though.

bubach avatar Feb 10 '15 00:02 bubach

I had the same problem (with Ruby + Sinatra + AssetPack + Uglifier). The compressed version creates a garbage output JS file ("undefined is not a function"). My fix was instead to use the uncompressed version because it gets minified into the aggregate JS file just fine.

Still, I would have definitely preferred not having to care. I could see how this would confuse & frustrate a newbie enough to scare them off.

robinetmiller avatar Feb 19 '15 01:02 robinetmiller

+1. We had the same problem. Scripts should end in a semicolon since otherwise they may break things if repackaged into a larger script, which is fairly common.

I agree with @robinetmiller, both that the uncompressed version works, and that it's nice if we don't have to care.

You can reproduce the issue by pasting the minified script into a JS file followed by a newline (optional) followed by "(function() {})();" or similar.

clayenga avatar Feb 27 '15 16:02 clayenga

Ah, this was driving me crazy. Definitely should end with ;

Jorenm avatar Apr 23 '15 23:04 Jorenm