在angular-cli生成的应用程序中,有angular-cli.json
文件控制操作。
但是我们如何排除root中指定的src内的一些文件夹?
"apps": [{
"root": "src",
"outDir": "dist",
"assets": [
"assets",
"favicon.ico"
],
"index": "index.html",
"main": "main.ts",
"polyfills": "polyfills.ts",
"test": "test.ts",
"tsconfig": "tsconfig.app.json",
"testTsconfig": "tsconfig.spec.json",
"prefix": "app",
"styles": [
"styles.css"
],
"scripts": [],
"environmentSource": "environments/environment.ts",
"environments": {
"dev": "environments/environment.ts",
"prod": "environments/environment.prod.ts"
}
}],
我想添加"exclude": [ "folder_name1", "folder_name1" ]
之类的内容,但我找不到任何同意的解决方案。
答案 0 :(得分:5)
ng-build
将运行tsc
来编译目标文件,您可以将exclude
设置添加到tsconfig.app.json
以排除某些特定文件或文件夹。
{
"compilerOptions": {
...
},
"exclude": [
"folder" // example
]
}
答案 1 :(得分:0)
此配置位于tsconfig-json https://www.typescriptlang.org/docs/handbook/tsconfig-json.html
中{
"compilerOptions": {
"module": "system",
"noImplicitAny": true,
"removeComments": true,
"preserveConstEnums": true,
"outFile": "../../built/local/tsc.js",
"sourceMap": true
},
"include": [
"src/**/*"
],
"exclude": [
"node_modules",
"**/*.spec.ts"
]
}