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+?
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
You can also add sourceMap: false into the configuration of angular.json as shown below
I suppose they are false by default for production build when using Angular 6+ with cli.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With