Why does Google Chrome accuse you that jquery.min.map is missing?

Asked

Viewed 1,381 times

13

I downloaded the version of jQuery 1.10.1 minimized and Google Chrome is warning in the developer tools, Network tab, that jquery.min.map was not found: error 404

Note: jQuery works correctly.

That one jquery.min.map is a new dependency to use jQuery?

  • This only happens in Google Chrome?

2 answers

12

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

If you are in a production environment, the archive .map it is not necessary, after all, it is expected that no error will occur. Use only during development.

jquery-1.10.1.min. map

  • But this file is only requested when errors occur?

  • 3

    In the case of Google Chrome you can open the Developer Tools (F12), open the settings (icon at the bottom right) and uncheck "Enable JS source maps". The file will only be used to display information on this panel and has no effect on the end-user page.

12


A file .map allows mapping a minimized javascript file (minified) to the original file. Then we can debug a web page without needing to change the system on the server, ie:

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

There are other details, advantages and applications that can be read in the article 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 via the option Enable Source Maps, as shown below (taken from the cited article):

inserir a descrição da imagem aqui

Browser other questions tagged

You are not signed in. Login or sign up in order to post.