Opened 11 years ago
Last modified 8 years ago
#24879 new enhancement
Sourcemaps should be provided for use with minified javascript libraries
Reported by: | jblz | Owned by: | |
---|---|---|---|
Milestone: | Future Release | Priority: | normal |
Severity: | normal | Version: | |
Component: | Build/Test Tools | Keywords: | dev-feedback needs-patch |
Focuses: | Cc: |
Description
Sourcemaps make it possible to debug minified files.
Supported in Chrome:
https://developers.google.com/chrome-developer-tools/docs/javascript-debugging#source-maps
Landing in Firefox in v23:
https://wiki.mozilla.org/DevTools/Features/SourceMap
When this feature is enabled, the Chrome console currently shows a 404 when the script specifies a sourcemap file and it isn't found.
Change History (14)
#5
in reply to:
↑ 1
@
11 years ago
Replying to jblz:
jQuery provides a sourcemap:
http://blog.jquery.com/2013/01/09/jquery-1-9-rc1-and-migrate-rc1-released/#sourcemaps
But since we're customizing it ( see [24791] & #24821 ), we'd need to include our own source & sourcemap files.
If the sole need of an edit is to add some initialization code after the file has been enqueued, I think it's better to not touch the upstream files but just add the initialization code as data, for example see #25277.
Also according to http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/?ModPagespeed=noscript it is explained that you can use any scripts you want with such maps, it is just that your compiler/minified needs to have support for it.
So this might be something easy to fix in the build process, see [25001]
#6
@
11 years ago
https://github.com/mishoo/UglifyJS2#source-map-options
https://github.com/gruntjs/grunt-contrib-uglify#source-maps
The grunt file looks to be using UglifyJS2, which supports source-maps, which means we can just set the proper configuration.
#7
@
11 years ago
Another option is to delete the sourcemap line out of the comment header at the same time the no conflict line is added, but I really believe that adding the proper source map is a better solution. For that, the removal of the production version should be reverted, and it should be minified as part of the build process, and generate the sourcemap at the same time.
jQuery provides a sourcemap:
http://blog.jquery.com/2013/01/09/jquery-1-9-rc1-and-migrate-rc1-released/#sourcemaps
But since we're customizing it ( see [24791] & #24821 ), we'd need to include our own source & sourcemap files.