找不到angular.min.js.map,究竟是什么?

本文翻译自:angular.min.js.map not found, what is it exactly?

When I load the page and check chrome console i find these errors: 当我加载页面并检查chrome控制台时,我发现这些错误: 在此输入图像描述

what exactly are map files in angular? 什么是角度的地图文件?

I did reference the angular.min.js but not the angular.min.js.map. 我确实引用了angular.min.js,但没有引用angular.min.js.map。 I am using the angular 1.2 rc release by the way and I just started seeing these errors when i switched to this release. 我正在使用角度1.2 rc版本,当我切换到此版本时,我刚开始看到这些错误。

ERRORS:
GET http://localhost:44786/Scripts/angular-route.min.js.map 404 (Not Found)       :44786/Scripts/angular-route.min.js.map:1
GET http://localhost:44786/Scripts/angular-animate.min.js.map 404 (Not Found) :44786/Scripts/angular-animate.min.js.map:1
GET http://localhost:44786/Scripts/angular-resource.min.js.map 404 (Not Found) :44786/Scripts/angular-resource.min.js.map:1
GET http://localhost:44786/Scripts/angular.min.js.map 404 (Not Found) :44786/Scripts/angular.min.js.map:1

#1楼

参考:https://stackoom.com/question/1FJOz/找不到angular-min-js-map-究竟是什么


#2楼

Monkey is right, according to the link given by monkey 根据猴子给出的链接,猴子是对的

Basically it's a way to map a combined/minified file back to an unbuilt state. 基本上,它是一种将组合/缩小文件映射回未构建状态的方法。 When you build for production, along with minifying and combining your JavaScript files, you generate a source map which holds information about your original files. 当您为生产构建时,以及缩小和组合JavaScript文件,您将生成一个源映射,其中包含有关原始文件的信息。 When you query a certain line and column number in your generated JavaScript you can do a lookup in the source map which returns the original location. 在生成的JavaScript中查询某个行和列号时,可以在源映射中执行查找,该映射将返回原始位置。

I am not sure if it is angular's fault that no map files were generated. 我不确定是否有角度的错误,没有生成地图文件。 But you can turn off source map files by unchecking this option in chrome console setting 但您可以通过在Chrome控制台设置中取消选中此选项来关闭源地图文件

在此输入图像描述


#3楼

As eaon21 and monkey said, source map files basically turn minified code into its unminified version for debugging. 正如eaon21和Monkey所说,源映射文件基本上将缩小的代码转换为其未经编译的版本以进行调试。

You can find the .map files here . 你可以在这里找到.map文件。 Just add them into the same directory as the minified js files and it'll stop complaining. 只需将它们添加到与缩小的js文件相同的目录中,它就会停止抱怨。 The reason they get fetched is the 他们获取的原因是

/*
//@ sourceMappingURL=angular.min.js.map
*/

at the end of angular.min.js. 在angular.min.js的末尾。 If you don't want to add the .map files you can remove those lines and it'll stop the fetch attempt, but if you plan on debugging it's always good to keep the source maps linked. 如果您不想添加.map文件,您可以删除这些行,它将停止获取尝试,但如果您打算进行调试,则始终保持源映射的链接。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章