[英]Exclude with pattern in tsconfig.json
Is there any way to add a pattern in the exclude property of a tsconfig file or is it only able to support directories?有没有办法在 tsconfig 文件的 exclude 属性中添加模式,或者它是否只能支持目录?
I'm trying to exclude all my test files from compilation so I was wondering if I can use something like this :我试图从编译中排除我所有的测试文件,所以我想知道我是否可以使用这样的东西:
src/**/*.spec.ts
Seems like it doesn't work though.虽然它似乎不起作用。
Full example if anyone needs it:如果有人需要它的完整示例:
{
"compilerOptions": {
...
},
"include": [
"src/**/*"
],
"exclude": [
"src/**/*.spec.ts"
]
}
Globs work in Typescript 2.0+. Glob 在 Typescript 2.0+ 中工作。 You would do "exclude" : ["src/**/*.spec.ts"]
in your tsconfig.json
.您可以在tsconfig.json
执行"exclude" : ["src/**/*.spec.ts"]
。
https://basarat.gitbook.io/typescript/content/docs/project/files.html https://basarat.gitbook.io/typescript/content/docs/project/files.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.