profile
viewpoint

Ask questionsOption "baseHref" is deprecated: Use the "baseHref" option in the browser builder instead.

🐞 Bug report

Command (mark with an x)

<!-- Can you pin-point the command or commands that are effected by this bug? --> <!-- ✍️edit: -->

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

Is this a regression?

Description

Redundant warnings from Angular CLI when trying to start angular application in dev mode.

🔬 Minimal Reproduction

> npx @angular/cli@v11.0.0-rc.0 new web-applications --create-application=false --strict
> cd web-applications
> yarn ng generate application support-panel --routing --style css
  • Edit angular.json and add values for baseHref, deployUrl under ng serve(not ng build) so that the app is served over http://localhost:4200/support/ and not http://localhost:4200/
    "serve": {
          "builder": "@angular-devkit/build-angular:dev-server",
          "options": {
            "browserTarget": "support-panel:build",
            "baseHref": "/support/",
            "deployUrl": "/support/"
          },

baseHref_angular

  • > yarn ng serve --project support-panel warnings_cli_baseHref

🔥 Exception or Error

<pre><code> Option "baseHref" is deprecated: Use the "baseHref" option in the browser builder instead. Option "deployUrl" is deprecated: Use the "deployUrl" option in the browser builder instead. </code></pre>

🌍 Your Environment

<pre><code> $ ng version

Angular CLI: 11.0.0-rc.0 Node: 15.0.1 OS: darwin x64

Angular: 11.0.0-rc.0 ... animations, cli, common, compiler, compiler-cli, core, forms ... platform-browser, platform-browser-dynamic, router Ivy Workspace: Yes

Package Version

@angular-devkit/architect 0.1100.0-rc.0 @angular-devkit/build-angular 0.1100.0-rc.0 @angular-devkit/core 11.0.0-rc.0 @angular-devkit/schematics 11.0.0-rc.0 @schematics/angular 11.0.0-rc.0 @schematics/update 0.1100.0-rc.0 rxjs 6.6.3 typescript 4.0.3

Done in 1.00s. </code></pre>

Anything else relevant?

angular/angular-cli

Answer questions alan-agius4

This is indented as these options have been deprecated in the dev-server (serve) builder.

Configure the options under the the browser (build) builder instead.

baseHref and deployUrl are build and dev-server settings and therefore should be configured in the build builder.

useful!
source:https://uonfu.com/
answerer
Alan Agius alan-agius4 Malta Angular Team, Loves TypeScript, Build Tools, Food, Beer & Coffee 🇲🇹
Github User Rank List