Opened 12 years ago
Last modified 5 months ago
#24879 new enhancement
Sourcemaps should be provided for use with minified javascript libraries
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Future Release | Priority: | normal |
| Severity: | normal | Version: | |
| Component: | Build/Test Tools | Keywords: | dev-feedback needs-patch 2nd-opinion |
| 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 (15)
#5
in reply to:
↑ 1
@
12 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.
#6
@
12 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
@
12 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.
This ticket was mentioned in Slack in #core by drew. View the logs.
11 years ago
This ticket was mentioned in Slack in #core by drew. View the logs.
11 years ago
This ticket was mentioned in Slack in #core by drew. View the logs.
11 years ago
This ticket was mentioned in Slack in #core by drew. View the logs.
11 years ago
#13
@
11 years ago
- Milestone changed from 4.2 to Future Release
Doesn't seem to be much interest in pursuing this, and no activity here in about a month. Punting.
#14
@
9 years ago
- Component changed from External Libraries to Build/Test Tools
- Keywords needs-patch added
I think we should extend the Grunt tasks to generate source maps when we ship both unminified and minified versions of a library.
#15
@
5 months ago
- Keywords 2nd-opinion added
Hey Everyone,
I've just taken a quick look into this ticket, and I am not sure why this ticket stalled but I believe providing sourcemaps for the minified JavaScript libraries in WP is a massive win for the developer community and is long overdue.
The primary benefit is a modern debugging experience, which is essential for anyone working with WP's JavaScript, from the classic admin to the block editor. This will lower the barrier for new contributors and make it easier for everyone to build on WordPress.
The historical concerns about performance have been fully addressed now that we know that they have zero impact on site performance for end-users, as they are only loaded when developer tools are open.
However digging through the code within the Gruntfile.js it looks like other historical tickets have had an impact on this, as there looks to have been several tickets that have removed this functionality at various points:
As of such I believe we should look into implementing this into the GitHub and SVN versions of the site for developers who are contributing / testing, but I don't believe this is necessary for the production release?
It would be good to get a second opinion here, and as of such I have attached the 2nd-opinion tag. 😃
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.