Angular-cli: ng build <project> --<some-flag> results in 'Unknown option: --<some-flag>'

Created on 18 Sep 2018  路  5Comments  路  Source: angular/angular-cli

Bug Report or Feature Request (mark with an x)

- [x] bug report
- [ ] feature request

Command (mark with an x)

- [ ] new
- [x] build
- [ ] serve
- [ ] test
- [ ] e2e
- [ ] generate
- [ ] add
- [ ] update
- [ ] lint
- [ ] xi18n
- [ ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc

Versions

Node: v10.6.0
NPM: v6.1.0
CLI: v6.2.2
Mac OSX El Capitan (10.11.6)

Repro steps

I've just tested some flags like --delete-output-path, --output-path and --build-optimizer or --vendor-chunk. I know that it uses --prod implicitly and supports --watch since latest upgrade.

ng generate library my-lib
ng build my-lib --delete-output-path=false

The log given by the failure

Unknown option: --deleteOutputPath

Desired functionality

The ng build command should provide the same functionality for libraries as for usual projects.

devkibuild-angular more info

Most helpful comment

@hansl As stated in the issue I'm using 6.2.2.
@alan-agius4 If that's the case then please update the docs, it reads as all flags are also supported for libraries. Despite that I think at least some flags should also work for library builds. Especially everything related to dist folder, as these flags were introduced to support valid use cases - f.e. hosting the compiled library on private git repos etc.

All 5 comments

Hey @arm1n ,

What version of the CLI are you using? Please run ng version from your project and paste the result here. Thanks!

This is correctly erroring out as the library builder doesn鈥檛 support these flags.

Those flags are valid for the application builder. Building a library has different pipeline then building an application thus it cannot have the same flags, for instance build-optimizer or vendor-chunks cannot be used in libraries among others.

Valid flags for library builder are watch and tsConfig

@hansl As stated in the issue I'm using 6.2.2.
@alan-agius4 If that's the case then please update the docs, it reads as all flags are also supported for libraries. Despite that I think at least some flags should also work for library builds. Especially everything related to dist folder, as these flags were introduced to support valid use cases - f.e. hosting the compiled library on private git repos etc.

I'd also expect many of flags to be working with libraries builder
--poll
--forked-type-checker
--verbose
and so on

So voting for @arm1n comment above :)

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