angular-cli: Production environment is not minifying resources

I am running my server on production and i am noticing that none of the hosted resources is minified/uglified.

How do i need to run my project in order to have gzip compression and resources minification?

What is the environment 'production': false, attribute for ?

We have been discussing the problem countless times at my workplace. We have choosen to use ng serve for development only. How is everyone else doing ?

PS: keep up good work, angular-cli is getting better and better. thanks alot.

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 15 (7 by maintainers)

Most upvoted comments

‘ng serve --prod’ is the same as ‘ng serve --target=production --environment=production’

Just wanted to add that you can find some more info in https://github.com/angular/angular-cli/wiki/build.

Cheers to @clydin and @grizzm0 !

I got all my questions answered. Thanks @grizzm0 and @clydin

Target runs different webpack configs. Production does minification, optimization, hashing etc that development doesn’t.

The environment files are where you can put different type of configs depending on the environment. API urls etc etc. The default “production” key is used in main.ts to call enableProdMode(); which is part of angular itself.

ng serve --environment=production changes the environment, not the target. That would run a dev target with prod env.