Exclude with pattern in tsconfig.json
TypescriptTsconfigTypescript Problem Overview
Is there any way to add a pattern in the exclude property of a tsconfig file or is it only able to support directories?
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.
Typescript Solutions
Solution 1 - Typescript
Full example if anyone needs it:
{
"compilerOptions": {
...
},
"include": [
"src/**/*"
],
"exclude": [
"src/**/*.spec.ts"
]
}
Solution 2 - Typescript
Globs work in Typescript 2.0+. You would do "exclude" : ["src/**/*.spec.ts"]
in your tsconfig.json
.
More
https://basarat.gitbook.io/typescript/content/docs/project/files.html