I am facing a challenge in typescript with my project structure as follows:
.
+-- @types
| +-- declaration1.ts
| +-- declaration2.ts
+-- common
| +-- utils1.ts
| +-- utils2.ts
+-- tests
| +-- utils1.test.ts
| +-- utils2.test.ts
To ensure that all my types are exposed in both tests and commons, I have added the following configuration in my tsconfig.json file:
{
"compilerOptions": {
"outDir": "build/",
},
"include": ["tests", "common", "@types"]
}
However, the issue I'm encountering is that I do not want to compile everything, just the common utilities. Unfortunately, I cannot specify a single or multiple entry points for compilation.
What I would like is to run tsc
and have the build folder filled only with the common utility files, structured like this:
.
+-- build
| +-- common
| | +-- utils1.js
| | +-- utils2.js
// no other files
But instead, what I currently end up with is:
.
+-- build
| +-- @types
| | +-- declaration1.js
| | +-- declaration2.js
| +-- common
| | +-- utils1.js
| | +-- utils2.js
| +-- tests
| | +-- utils1.test.js
| | +-- utils2.test.js
I am struggling to figure out how to exclude certain directories from being compiled.
If anyone has an idea on how to achieve this, your help would be greatly appreciated. Thank you.