Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular CLI v6: "Unknown option: '--bh'"

Versions

Angular CLI: 6.0.0
Node: 8.11.1
OS: win32 x64
Angular: 6.0.0
... animations, cli, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, platform-server, router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.6.0
@angular-devkit/build-angular     0.6.0
@angular-devkit/build-optimizer   0.6.0
@angular-devkit/core              0.6.0
@angular-devkit/schematics        0.6.0
@angular/cdk                      6.0.1
@angular/flex-layout              6.0.0-beta.15
@angular/material                 6.0.1
@ngtools/webpack                  6.0.0
@schematics/angular               0.6.0
@schematics/update                0.6.0
rxjs                              6.1.0
typescript                        2.7.2
webpack                           4.6.0

Steps

Install Angular v6 / CLI v6

ng build --configuration=stage --bh /XYZ/

Error Unknown option: '--bh'

Observed behavior The build --bh CLI option does not work in v6 (or was removed?), however the documentation hasn't been updated to reflect the new way to build with 'base-href'?

like image 340
Suvonkar Avatar asked May 09 '18 06:05

Suvonkar


1 Answers

Did you try using the full option name ?

ng build --configuration=stage --base-href /XYZ/

I'm using angular 6 and this still works. However I'm not sure if it's still meant to work in the future (cf this github issue)

If the way above does not work, you can specify baseHref in your configurations section in your angular.json file

 "build": {
          "builder": "@angular-devkit/build-angular:browser",
          "options": {

          },
          "configurations": {
            "stage": {
              "optimization": true,
              "baseHref": "/XYZ/", //<=== here
like image 103
David Avatar answered Oct 19 '22 16:10

David