在加载 ASP.NET 网页时丢失 Underscore.js 的 Javascript“ . map”文件

我有一个网页是运行在 Azure 上的 ASP.NET 网站的一部分。现在运行良好已经有一段时间了。突然之间,我发现浏览器在下载一个。用于 Underscore.js 的“ map”。我做了一些阅读,显然 JQuery 创建了。”。Map“文件作为 Javascript 源文件的调试辅助工具(”。Js”)。但是,如果我查看我的网站的 Scripts 目录,我发现这只发生在一些 JQuery 源文件中,而不是所有的,我不确定这种模式是什么。

但是,为什么浏览器要为 Underscore.js 加载不属于 JQuery 的“ map”文件呢?还有,为什么会突然发生这种事?很久以前,我在网页上添加了 Underscore.js,以前从来没有这个问题。

当我查看 Chrome 调试器控制台选项卡时,我得到的确切错误是:

获取 http://myazureapp.cloudapp.net/Scripts/underscore-min.map404(未找到)脚本/下划线 -min. map: 1

50704 次浏览

What you're experiencing is source mapping. This allows you to debug with readable code in your browser's developer tools when working with minified JS files.

The minified version of Underscore has this line at the end of the file:

//# sourceMappingURL=underscore-min.map

Your browser's developers tools will try to download underscore-min.map when encountering this line.

If you want to get rid of the error, either:

  1. Remove that line from underscore-min.js
  2. Add underscore-min.map and underscore.js to your project.