4 ms·
On a side note, you should preserve some new lines in your minified js as it makes dealing with production JavaScript errors much easier, assuming you have some
by VieElm 11y ago
On a side note, you should preserve some new lines in your minified js as it makes dealing with production JavaScript errors much easier, assuming you have some kind of onerror hook that sends you js errors. The new lines don't add much to the overall size of your js but they make debugging much easier.
- venomsnake 11y agoTell that to the people that pack jQuery ...
- woah 11y agoYou should use source maps
- MrBuddyCasino 11y agoThats what I do, too. It makes debugging so much easier, and you can safe yourself the pain of source maps. A few bytes I gladly spend on keeping my sanity.
- crough 11y agoI've always wondered why minifiers don't take advantage of ASI to this effect. Your files come out the exact same size as cramming it onto a line with semicolons...
- nchelluri 11y agoWe have been meaning to get around to looking into this on my current project but haven't yet: I believe the browser's error event will return a column number. > Column numbers in Firefox. Firefox is the only browser that doesn't support column numbers for exceptions. This makes debugging minified javascript essentially impossible. I've sent one patch but there's a lot more to do. https://bugsnag.com/blog/js-stacktraces/ https://bugsnag.com/blog/js-stacktraces/ - written in 2014 but MDN now says: > Column number for the line where the error occurred (number) - Requires Gecko 31.0 https://developer.mozilla.org/en-US/docs/Web/API/GlobalEventHandlers/onerror https://developer.mozilla.org/en-US/docs/Web/API/GlobalEvent... If anybody has live experience with this, I'm eager to hear about it.
- VieElm 11y agoYes you get column numbers and that really helps as well, but as mentioned new lines don't really hurt that much and I'd rather have some new lines than none. In response to others about using source maps, I'm talking about production errors received from users in the wild who may or may not have source maps enabled in their browser.