将 Angular 从 8 更新到 9 后延迟加载的模块警告 [英] Lazy-loaded modules warnings after updating Angular from 8 to 9
本文介绍了将 Angular 从 8 更新到 9 后延迟加载的模块警告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Angular 更新后所有延迟加载的模块返回警告:
After Angular update all lazy-loaded modules return warning:
Error: [path/to/module/module-name.ts] is missing from the TypeScript
compilation. Please make sure it is in your tsconfig via the 'files'
or 'include' property.
我的返回模块数组的函数:
My function which returns modules array:
export function manifests(prefix = '') {
return [
{
loadChildren: () => import(prefix + '/path/to/a.module').then(m => m.AModule),
path: 'a',
},
{
loadChildren: () => import(prefix + '/path/to/b.module').then(m => m.BModule),
path: 'b',
},
]
}
如果我用静态数组替换该函数,一切似乎都很好.为什么?
If I replace that function with static array everything seems to be fine, though. Why?
我的 tsconfig.app.json:
My tsconfig.app.json:
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "./out-tsc/app",
"types": []
},
"files": [
"src/main.ts",
"src/polyfills.ts",
"src/zone-flags.ts",
],
"include": [
"src/**/*.d.ts",
]
}
推荐答案
你可以在 tsconfig 下面的 include 属性中添加这个路径来排除
you can add this path to exclude in tsconfig below include property
"exclude": [
"path/to/module"
]
这篇关于将 Angular 从 8 更新到 9 后延迟加载的模块警告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文