Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to omit sourcemaps in Angular-CLI 6+ [duplicate]

I want to build with ng build without sourcemaps. In previous versions, I could use the --no-sourcemap or --sourcemap=false parameter, but now I get:

Unknown option: '--sourcemap'

How can I omit source maps in Angular-CLI 6+?

like image 939
BBaysinger Avatar asked Jul 10 '18 23:07

BBaysinger


2 Answers

Use --source-map . It takes default value true. So following command will not create sourcemaps:

ng build --source-map=false

Similarly --prod avoids creating sourcemaps by default but if you want to create then just use --source-map in the end to create sourcemaps.

Follow official Docs

Update:

For Angular cli 7 use below:

ng build --sourceMap=false

And if you want prod build with production config & bundling (thus don't want sourcemaps included in build folder) then use :

ng build --prod=true

Recent Official Docs

like image 191
Shantanu Avatar answered Sep 21 '22 14:09

Shantanu


You can also add sourceMap: false into the configuration of angular.json as shown below

enter image description here

I suppose they are false by default for production build when using Angular 6+ with cli.

like image 37
Harish Krishnan Avatar answered Sep 25 '22 14:09

Harish Krishnan