运行ng build时如何排除src根文件夹中的某些文件夹 [英] How do we exlude some folder in the root src folder when running ng build
问题描述
在我的由angular-cli生成的应用程序中,有一个angular-cli.json
文件可控制ng操作.
In my application generated by angular-cli there is angular-cli.json
file which control ng operations.
但是我们如何排除根目录中指定的src内的某些文件夹?
But how do we exclude some folder inside src which is specified in the root?
"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" ]
的内容,但是我找不到与此相符的解决方案.
Im thinking to add something like "exclude": [ "folder_name1", "folder_name1" ]
but i cannot find any solution that agree in this.
推荐答案
ng-build
将运行tsc
来编译目标文件,您可以将exclude
设置添加到tsconfig.app.json
中以排除某些特定的文件或文件夹./p>
ng-build
will run tsc
to compile target files, you can add exclude
settings into tsconfig.app.json
to exclude some specific files or folder.
{
"compilerOptions": {
...
},
"exclude": [
"folder" // example
]
}
这篇关于运行ng build时如何排除src根文件夹中的某些文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!