4 ms·
This is what sourcemaps are for. You can minify your JS files with the Closure Compiler and tell it to create a Source Map. Then tell the developer tools to use
by bmuon 14y ago
This is what sourcemaps are for. You can minify your JS files with the Closure Compiler and tell it to create a Source Map. Then tell the developer tools to use that sourcemap and you'll debug looking at the unminified code even if you're running the minified one.
http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/ http://www.html5rocks.com/en/tutorials/developertools/source...
- JohnBooty 14y agoFirst off, thanks for the link! I up-voted you; that's a really good introduction to source maps. I believe it would be incredibly useful if FF's dev tools could do some of this on their own; primarily for the reason that the person debugging the Javascript can't always control the build process. The times when you don't have access to the build process and/or the original unminified code are the times when you need this functionality the most.
- bmuon 14y agoIf you don't have any of those, then I don't see how the developer tools can figure out what the original source is. You need some way of mapping points in the minified file to lines in the original file. Ask your favorite CDN to also host a source map. Otherwise the best the developer tools can do is prettify the minified file, something both Chrome and IE do (I don't recall if Firefox Nightly does).
- unconed 14y agoI agree that source maps are the right solution, but even the ability to pretty-print the indentation and separate statements onto lines would work wonders. I've had too many errors on line 1.
- JohnBooty 14y ago"If you don't have any of those, then I don't see how the developer tools can figure out what the original source is." You don't think that un-minifying and pretty-printing the minified Javascript would be both: a) a lot easier than debugging an error on line 1 at column 28,482? and b) technically possible?