im creating an angular 13app using CLI i want to set a path to my app when i run it i got the following error :
Unknown option: '--base-href'
Unknown option: '/my-path/'
this is the command i run :
ng serve --base-href /my-path/
and
ng serve --base-href=/my-path/
and this are my dep :
"dependencies": {
"@angular/animations": "~13.2.0",
"@angular/common": "~13.2.0",
"@angular/compiler": "~13.2.0",
"@angular/core": "~13.2.0",
"@angular/forms": "~13.2.0",
"@angular/platform-browser": "~13.2.0",
"@angular/platform-browser-dynamic": "~13.2.0",
"@angular/router": "~13.2.0",
"@ng-bootstrap/ng-bootstrap": "^4.1.1",
"@reactivex/rxjs": "^6.6.7",
"angular-oauth2-oidc": "^13.0.1",
"bootstrap-icons": "^1.8.1",
"font-awesome": "^4.7.0",
"rxjs": "~7.5.0",
"tslib": "^2.3.0",
"zone.js": "~0.11.4"
},
any one have an idea about this isuue please and how i can set a path to my app in localhost ?
Regards
This option has been deprecated. You should set it in angular.json, here :
"acme-project": {
[...]
"architect": {
"build": {
"options": {
"baseHref": "/my-path/",
Adding to Arnauds answer.
If you don't want to change the baseHref for your development and perhaps not all builds, you should add baseHref to 'configurations' on selected config, and not to 'options.
f ex: in my project AngularExamplesAndSnippets i add the baseHref to my "github-pages" configuration
if you build for production you add it below "production"
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
...
},
"configurations": {
"github-pages": {
"baseHref": "/AngularExamplesAndSnippets/",
...
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With