Angular `ng serve --prod` is the same as `ng serve -c production`?
Asked Answered
W

2

6

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

Weevil answered 22/1, 2019 at 21:34 Comment(1)
Possible duplicate, please read #50175084Alsatia
G
9

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.

Golconda answered 22/1, 2019 at 21:51 Comment(0)
T
2

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.

Trigon answered 14/5, 2023 at 19:40 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.