动机::
使用Angular CLI创建App Shell,并定义从node_modules
内的包中延迟加载模块的路由。
步骤::
使用Angular CLI创建了一个app shell。
参考了app.routes.ts
const appShellRoutes: Routes = [
{ path: 'sample', loadChildren : './sample#SampleModule' }// location in src/app,
{path : 'visual-designer', loadChildren: 'visual-designer#VisualDesignerModule'} //location in node_modules
];
因为我需要配置带有path
&的tsconfigs。 include
的 tsconfig.app.json
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/app",
"baseUrl": "./",
"module": "es2015",
"types": [],
"paths": {
"@angular/*": [
"../node_modules/@angular/*"
],
"visual-designer": [
"../node_modules/visual-designer/*"
]
}
},
"exclude": [
"test.ts",
"**/*.spec.ts"
],
"include": [
"../src/**/*",
"../node_modules/visual-designer/*"
]
}
并在tsconfig.json中添加了include
根级别
{
"compileOnSave": false,
"compilerOptions": {
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"target": "es5",
"typeRoots": [
"node_modules/@types"
],
"lib": [
"es2017",
"dom"
]
},
"include": [
"./src/**/*"
]
}
问题:: 在此之后我得到了这个错误
要求我通过include
或files
我究竟错过了什么?看了这么多关于git的问题,发现只有这一个相关。 Git cli Issue
Angular CLI版本:1.6.7