Reputation: 2407
The typescript docs state that in tsconfig.json
we can control input files either with files
where we list all files, or with exclude
. I have all my source files in a src
directory and only want to compile all files that are there (to a bifferent directory, build
). I could exclude
all other files and directories, but I might miss something. I don't want to manually add every file to files
.
How can I specify to typescript that it should compile only the typescript files it finds in the src
directory, and nothing else?
Upvotes: 18
Views: 18627
Reputation: 1941
For anybody who stumbles across this question like I did -
Just like exclude
, directories can be included as well now.
I include just my src directory like this to compile only my src:
"include": [
"./src/**/*"
]
Upvotes: 28
Reputation: 121987
According to the TypeScript documentation, the only way to do this within tsconfig.json
is either to:
files
; orexclude
. It does mention that files referenced by included files will also be compiled, so it's possible that 1. wouldn't have to list everything individually, but I haven't tried that myself.
Upvotes: 4