[英]Property 'NameNews' does not exist on type using ng build --prod
[英]Ionic 5 build with --prod flag fails - Property 'translate' does not exist on type
我正在开发一个 Ionic 5 项目,当我使用 --prod 标志运行构建时,我收到以下错误:
Error: src/app/pages/edit-profile/edit-profile.page.html(8,142): Property 'translate' does not exist on type 'EditProfilePage'.
我已将其追溯到以下行:
<ion-input clearInput formControlName="userName" (ionBlur)="checkUserName($event.target.value)" (ionFocus)="userNameFocus()" placeholder="{{'USERNAME' || translate}}"></ion-input>
当我删除这一行时,带有 --prod 标志的构建是成功的。 它也可以在没有 --prod 标志的情况下构建。
这是我的 tsconfig.ts 文件:
{
"compileOnSave": false,
"compilerOptions": {
"baseUrl": "./",
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,
"downlevelIteration": true,
"experimentalDecorators": true,
"module": "es2020",
"moduleResolution": "node",
"importHelpers": true,
"target": "es2015",
"lib": ["es2018", "dom"],
"resolveJsonModule": true
},
"angularCompilerOptions": {
"fullTemplateTypeCheck": true,
"strictInjectionParameters": true
},
"exclude": [".history/*"]
}
有什么想法吗?
这是因为 prod 标志比其他标志具有更严格的构建时间规则。 您应该像这样使用单个 pipe :
{{'USERNAME' | translate}}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.