Why does Google Chrome accuse me of missing jquery.min.map?

13

I downloaded the version of jQuery 1.10.1 minimized and Google Chrome is alerting on the tools for developer, Network tab, jquery.min.map was not found: Error 404

Note: jQuery works correctly.

Is this jquery.min.map a new dependency for using jQuery?

    
asked by anonymous 18.12.2013 / 15:40

2 answers

12

A .map file allows you to map a minimized javascript file ( minified ) to the original file. So we can debug a webpage without having to change the system on the server, that is:

  • No more gambiarras to put the original jQuery in "development" mode and jQuery min in production mode
  • The code executed in the browser remains minified , but you can see the equivalent orignal snippet so you can understand what is happening

There are other details, advantages, and applications you can read in Introduction to JavaScript Source Maps .

As for Chrome, it tries to download the map whenever it finds a reference in the javascript file. Example:

/*! jQuery v1.10.2 | (c) 2005, 2013 jQuery Foundation, Inc. | jquery.org/license
//@ sourceMappingURL=jquery-1.10.2.min.map
*/

To avoid errors, remove the snippet from the Javascript file or disable this feature from the browser using the Enable Source Maps option, as shown below (extracted from the article quoted):

    
18.12.2013 / 16:54
12

The minified file loses information that may be useful when displaying details of an error, such as backtrace . JQuery comes with a .map file that gives this additional information to the browser, so you can use the minified library and at the same time not see incomprehensible error messages.

If you are in a production environment, the .map file is not required, after all, no error is expected to occur. Use only during development.

jquery-1.10.1.min.map

    
18.12.2013 / 15:45