Search code examples
javascriptangularjsminifysource-maps

Why we use minified version of Angularjs (Reason to give preference to angular.min.js over angular.js even if we are adding angular.min.js.map)


I added angular.min.js to my project and faced this issue.Chrome Developer Console screenshot

http://localhost:8000/AngularProject/angular.min.js.map 404 (Not Found) angular.min.js.map:1


Upon research, I found that adding angular.min.js.map got rid of the "404 (Not Found)" error. I also found the reason for "angular.min.js.map": we add it because "source map files basically turn minified code into its unminified version for debugging".

But, isn't the reason for using the minified file saving space and making the application faster? Now if we use angular.min.js we have to add angular.min.js.map also.

Wouldn't it be much simpler to just add angular.js rather than adding two files(angular.min.js, angular.min.js.map). What is the meaning of having a minified version of angular.js?


Solution

  • You are right and wrong.

    This .map file is for debug only and get downloaded by your browser when you open the debug mode.