Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I stop Angular from loading the .angular.min.js.map file when pulling Angular from a CDN?

Tags:

angularjs

cdn

I am working on a website which loads AngularJS from a CDN, and along with Angular it loads a 284KB map file (angular.min.js.map), which I understand is for debugging.

I don't want to debug, this is going into production, and 284KB is a lot! How do I stop this file from loading?

I can't edit the file (CDN), and it doesn't matter what my Google Chrome options are, I can't advise others to change their settings to use the website I am working on.

Thanks

like image 339
JMK Avatar asked Jun 13 '14 21:06

JMK


People also ask

What is min js map file?

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.

What is Sourcemappingurl?

The SourceMap HTTP response header links generated code to a source map, enabling the browser to reconstruct the original source and present the reconstructed original in the debugger.

What is the use of map file in JavaScript?

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.

What is the use of map files in TypeScript?

Explanation: TypeScript Map files are source map files that let tools map between the emitted JavaScript code and the TypeScript source files that created it. And these Source Map files will then help to debug the Typescript file instead of debugging the emitted JavaScript file.


1 Answers

According to http://blog.teamtreehouse.com/introduction-source-maps

The developer tools will only load this file if support for source maps is enabled and the developer tools are open.

So any impact will only be felt if someone opens their developers tools, which I suspect is acceptable, as in that case ability to debug it more important than download speed/size.

like image 67
Michal Charemza Avatar answered Sep 28 '22 17:09

Michal Charemza