まめーじぇんと@Tech

技術ネタに関して (Android, GAE, Angular). Twitter: @mame01122

angular.min.js.mapとは?

ローカルでWebサーバを立ち上げると(
Python SimpleHTTPServerでローカルWebサーバをたてる - まめージェント)、
ブラウザのコンソールに下記のようなエラーが表示されることがあります。

GET http://localhost:8000/js/angular.min.js.map 404 (File not found)

このエラー自体、特に悪さをするわけではないんですが、
興味本位で.mapとは何ぞや?ということで気になって調べてみました。

How to: angular.min.js.map not found, what is it exactly? | SevenNet
から読み解くに、どうやら、一言でいうとデバッグ用のファイル、とでも言えそうです。

//---
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. 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ファイルのProduction buildの際に作られるもので、
元々のソースファイルの行数を検索したりするのに使う”とあります。

なるほど。
AngularJSオリジナルというより、Javascriptで出てくる言葉のようです。
まあ、そのあたりには無知で・・・。
(違ったらゴメンナサイ。)

というこで、このエラーの解決法は、AngularJSのライブラリをzip形式で
ダウンロードしたときに一緒に入っている、
angular.min.js.mapを同じフォルダに入れておけば、エラーは消えます。