目前,Im正在将我的 app从v12升至v13,并注意到这一警告:
Option “deployUrl” is deprecated: 采用“基准Href”办法,“APP_BASE_HREF” DI aken 或两者结合。 详情见https://angular.io/guide/dplo#the-deploy-url.
在挖掘后,没有哪一个基地。 Href 或PAS_BASE_REF 备选办法确实为我所设立的机构工作,因此,我很想知道,我是否错误地使用这些办法,或者是否有良好办法来取代这些办法。
这里是一只神.的雕像。 json:
"dashboard": {
"projectType": "application",
"root": "apps/dashboard",
"sourceRoot": "apps/dashboard/src",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"allowedCommonJsDependencies": [],
"outputPath": "../dist/dashboard/",
"deployUrl": "/dist/dashboard/",
"index": "apps/dashboard/src/index.html",
"main": "apps/dashboard/src/main.ts",
"tsConfig": "apps/dashboard/tsconfig.app.json",
"polyfills": "apps/dashboard/src/polyfills.ts",
"styles": [
"apps/dashboard/src/styles.scss"
],
"scripts": [],
"stylePreprocessorOptions": {
"includePaths": [
"libs/assets/styles"
]
},
"aot": false,
"vendorChunk": true,
"extractLicenses": false,
"buildOptimizer": false,
"sourceMap": true,
"optimization": false,
"namedChunks": true
},
"configurations": {
"production": {
"aot": true,
"buildOptimizer": true,
"extractLicenses": true,
"fileReplacements": [
{
"replace": "apps/dashboard/src/environments/environment.ts",
"with": "apps/dashboard/src/environments/environment.prod.ts"
}
],
"namedChunks": false,
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"vendorChunk": false
},
"es5": {
"tsConfig": "apps/dashboard/tsconfig.es5.json"
}
},
"defaultConfiguration": ""
}
}
}
Snippet of routing file:
export const DashboardRoutes: Routes = [
{ path: , pathMatch: full , redirectTo: /dashboard },
{
path: dashboard ,
data: {
label: Dashboard ,
appBase: true
},
children: [
// this is a child so we can load the component in same router-outlet
{
path: ,
loadChildren: () => import( ./dashboard/dashboard.module ).then(m => m.DashboardModule),
data: {
authorizedRoles: [ member ],
}
},
// ...other children
]
}
]
我试图将部署的Url改为基地Href,而这种工程、种类——将主页从<条码>改为“当地东道/dash板代码>改为<条码>。 (明显不正确)和仅仅将空洞或“/”装上正确(如上)的 app/薄板。
值得注意的是,我的指数.html确实使用了<代码><base href=”/“>和PAS_BASE_HREF在评估模块提供者中并非凌驾于一切。