找不到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文件,您可以刪除這些行,它將停止獲取嘗試,但如果您打算進行調試,則始終保持源映射的鏈接。

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