Bug Tracker

Opened 7 years ago

Last modified 7 years ago

#14415 closed feature

Remove sourcemap comment — at Version 1

Reported by: dmethvin Owned by:
Priority: blocker Milestone: 1.11/2.1
Component: build Version: 1.10.2
Keywords: Cc:
Blocked by: Blocking:

Description (last modified by dmethvin)

In the core meeting on Monday, we discussed how to deal with some of the problems that arose from adding sourcemap support:

  • Chrome spews a 404 on the console if you use the min file and it can't find the map, because sourcemaps are now enabled by default.
  • Web devs don't know that they have to now copy three files (minified, map, unminified) whenever they want to use the minified file or they'll get a 404.
  • Web devs don't realize that renaming one or all of these files is not sufficient to please the sourcemap gods, and they again get a 404.

This problem has become extremely common:

http://stackoverflow.com/questions/18365315/jquerys-jquery-1-10-2-min-map-is-triggering-a-404-not-found http://wordpress.org/support/topic/get-wp-adminjquery-1102minmap-404-not-found http://www.kendoui.com/forums/kendo-ui-complete-for-asp-net-mvc/installer-vs-extensions/jquery-min-map-not-found.aspx http://blog.clicdata.com/2013/09/12/404-error-on-chrome-when-getting-jquery-minified-map/

Much of this mess is due to limitations in the sourcemap "spec" itself, which isn't a formal W3C spec but just written in this document:

https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit

Given the confusion above and the fact that many users are actually editing the file to avoid the 404 message, we may consider removing the sourcemap comment in the next version of jQuery.

Here are the things we'd like to see sourcemaps accommodate:

  • Allow files to be renamed in the file system but still have sourcemaps work properly if a consistent naming is used. For example, renaming jquery-1.10.2.min.js to jquery.min.js would be fine as long as the corresponding map was renamed to jquery.min.map. That means the minified and map files should *not* contain full file names in their source.
  • Make it possible to have just a local .min.js file but use public .min.map and uncompressed .js file from a CDN for example. Again this isn't possible at the moment because the map refers back to the minified file, and that will be a local file, not be the one on the CDN.
  • Outside the spec, but dev tools should not simply barf out 404 warnings to the console for this case. If the user tries to view source or set breakpoints there should be a clear message about why things are messed up.
  • Make it possible for users to specify a map file manually via a URL in dev tools. This would allow us to ship a file without a sourcemap comment but the user could add the association themselves if they use maps.

Change History (1)

comment:1 Changed 7 years ago by dmethvin

Component: unfiledbuild
Description: modified (diff)
Milestone: None1.11/2.1
Priority: undecidedblocker
Note: See TracTickets for help on using tickets.