[fix]-Missing Javascript “.map” file for Underscore.js when loading ASP.NET web page

Wikitechy | 2592 Views | javascript | 01 Jun 2016


Scenario :

An ASP.NET web page is running on Azure. Suddenly a notification from browser raised which was trying to download a ".map" for Underscore.js. JQuery creates ".map" files as debugging aids for Javascript source files (".js"). However, a look at the Scripts directory for the web site reveals that this only happens for some JQuery source files and not all. But the browser is trying to load a ".map" file for Underscore.js which is not part of JQuery. 

Error :

The exact error that occurs in the Chrome Debugger Console tab is:

GET http://myazureapp.cloudapp.net/Scripts/underscore-min.map 404 (Not Found) 

Fix :

  • The issue occurs because of source mapping. This allows to debug with readable code in the browser's developer tools when working with minified JS files.
  • The minified version of Underscore.js file has this command at the end of the file:

//# sourceMappingURL=underscore-min.map

Hence the browser's developer’s tools will try to download 

underscore-min.map on encounter with this line. To avoid the download, 

1. The line of command must be removed from underscore-min.js.

2. Add underscore-min.map and underscore.js to the project file to avoid further chaos.

Fixes are applicable to the following versions of Javascript :

  • javascript1.1
  • javascript1.2
  • javascript1.3
  • javascript1.4
  • javascript1.5
  • javascript1.6
  • javascript1.7

Related Error Tags : 

  • underscore in Javascript
  • javascript - missing .map resource?
  • Fetching the value from a map by index using Underscore.js


Bug Bounty
IOT Hackathon

Join our Community