Recently I have seen files with .js.map
extension shipped with some JavaScript libraries (like Angular), and that just raised few questions in my head:
.js.map
file?angular.min.js.map
file?.js.map
files for my JavaScript applications?angular.min.js.map
and it was filled with strange-formatted strings so I assume it's not created manually.The .map
files are for js
and css
(and now ts
too) files that have been minified. They are called SourceMaps. When you minify a file, like the angular.js file, it takes thousands of lines of pretty code and turns it into only a few lines of ugly code. Hopefully, when you are shipping your code to production, you are using the minified code instead of the full, unminified version. When your app is in production, and has an error, the sourcemap will help take your ugly file, and will allow you to see the original version of the code. If you didn't have the sourcemap, then any error would seem cryptic at best.
Same for CSS files. Once you take a SASS or LESS file and compile it to CSS, it looks nothing like its original form. If you enable sourcemaps, then you can see the original state of the file, instead of the modified state.
So, to answer you questions in order:
I hope this makes sense.