5

I am using Angular 7 and I wonder if

ng serve --prod

is the same as

ng serve -c production

Can't find that in the documentation so any help would be appreciated

R. Richards
  • 24,603
  • 10
  • 64
  • 64
ET-CS
  • 6,334
  • 5
  • 43
  • 73
  • 1
    Possible duplicate, please read https://stackoverflow.com/questions/50174584/how-to-set-environment-via-ng-serve-in-angular-6 – mruanova Jan 22 '19 at 21:59

2 Answers2

8

There is some documentation on it here: https://angular.io/cli/build

It says that -c is the alias for --configuration

A named build target, as specified in the "configurations" section of angular.json. Each named target is accompanied by a configuration of option defaults for that target.

Aliases: -c

The documentation for --prod says:

When true, sets the build configuration to the production target. All builds make use of bundling and limited tree-shaking. A production build also runs limited dead code elimination.

So it sounds to me like the same thing.

DeborahK
  • 57,520
  • 12
  • 104
  • 129
1

In Angular 16, both are not the same.

ng serve --prod

The above command throws error -

Error: Unknown argument: prod

However, ng serve -c production works as expected with the following output.

Warning: 'outputHashing' option is disabled when using the dev-server. **************************************************************************************** This is a simple server for use in testing or debugging Angular applications locally. It hasn't been reviewed for security issues.

DON'T USE IT FOR PRODUCTION! **************************************************************************************** ✔ Browser application bundle generation complete.

You can verify by checking the size of the chunk files. It should be significantly less than the dev build.

Prateek Kumar Dalbehera
  • 2,194
  • 3
  • 24
  • 30