嗨,我关注了有关代码共享的文档。
我有一个仅针对移动平台的组件。它称为 list-modal.component.tns.ts 。因此,文件名中带有.tns文件,这样就不应该在自动编译过程中对它进行编译吗?
事实并非如此,该命令引发了一个错误,提示:
无法确定类ListModalComponent中的模块 /home/jcfrane/Zimitech/acc6dev/ams-pwa-native/src/app/shared/component/list-modal-component/list-modal.component.tns.ts! 将ListModalComponent添加到NgModule中进行修复。
这是我的tsconfig.json:
{
"compileOnSave": false,
"compilerOptions": {
"outDir": "./dist/out-tsc",
"declaration": false,
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"target": "es5",
"typeRoots": [
"node_modules/@types"
],
"lib": [
"es2017",
"dom",
"es6",
"es2015.iterable"
],
"baseUrl": ".",
"paths": {
"~/*": [
"src/*"
]
}
},
"exclude": [
"**/*.tns.ts",
"**/*.android.ts",
"**/*.ios.ts",
"**/*.spec.ts",
]
}
和我的tsconfig.tns.json:
{
"extends": "../tslint.json",
"rules": {
"directive-selector": [
true,
"attribute",
"app",
"camelCase"
],
"component-selector": [
true,
"element",
"app",
"kebab-case"
]
}
}
这是我的tsconfig.app.json:
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "./out-tsc/app",
"module": "es2015",
"types": []
}
}
您会看到.tns文件应免于编译。
为什么仍在编译?
谢谢!