Angular-cli: ng build prod confusion: --prod vs -prod (one vs two dashes)

Created on 19 May 2017  路  4Comments  路  Source: angular/angular-cli

Bug Report or Feature Request (mark with an x)

- [ ] bug report -> please search issues before submitting
- [x] feature request

Versions.

@angular/cli: 1.0.3
node: 6.10.2
os: win32 x64
@angular/animations: 4.1.3
@angular/common: 4.1.3
@angular/compiler: 4.1.3
@angular/core: 4.1.3
@angular/forms: 4.1.3
@angular/http: 4.1.3
@angular/material: 2.0.0-beta.5
@angular/platform-browser: 4.1.3
@angular/platform-browser-dynamic: 4.1.3
@angular/router: 4.1.3
@angular/flex-layout: 2.0.0-beta.8
@angular/cli: 1.0.3
@angular/compiler-cli: 4.1.3

Repro steps.

Not a real bug, but confusing:
When creating a new project with the Angular CLI, the README file contains the following:

Run ng build to build the project. The build artifacts will be stored in the dist/ directory. Use the -prod flag for a production build.

And the output of ng build -h lists the following:

$ ng build -h
ng build <options...>
  Builds your app and places it into the output path (dist/ by default).
  aliases: b
  --target (String) (Default: development) Defines the build target.
    aliases: -t <value>, -dev (--target=development), -prod (--target=production), --target <value>
...

And https://github.com/angular/angular-cli/wiki/build says to use

ng build --prod

I've tried both ng build --prod and ng build -prod and they both produced exactly the same output. But it was confusing to see those two different options in the docs/tools.

Desired functionality.

On recommended way to produce a prod build (README, wiki, ng build help)

easy (hours) help wanted 2 (required) confusing

All 4 comments

I agree this is confusing, the appropriate fix is to update the documentation to reference the single dash alias for both dev and prod.

The file which would need updated is here:
https://github.com/angular/angular-cli/blob/master/docs/documentation/build.md

@Brocco I think this issue can be closed now. Thanks

using ng buld, the old code available, how to clear old code?

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

_This action has been performed automatically by a bot._

Was this page helpful?
0 / 5 - 0 ratings

Related issues

delasteve picture delasteve  路  3Comments

rwillmer picture rwillmer  路  3Comments

rajjejosefsson picture rajjejosefsson  路  3Comments

jmurphzyo picture jmurphzyo  路  3Comments

hartjo picture hartjo  路  3Comments