I’m re-organizing several unrelated typescript projects into a mono-repo structure. Currently I have a tsconfig.json
file in each workspace, which are all identical. I would like to have a “common” tsconfig in the base folder which includes path names and completely remove ./packages/*/tsconfig.json
. Here’s an example of my project structure:
packages/
| foo/
| | src/
| | | index.ts
| | package.json
| | tsconfig.json
| bar/
| | src/
| | | index.ts
| | package.json
| | tsconfig.json
| asd/
| | src/
| | | index.ts
| | package.json
| | tsconfig.json
package.json
./packages/foo/tsconfig.json
(for example):
{
"compilerOptions": {
"strict": true,
"outDir": "dist",
"declaration": true,
"declarationDir": "types",
},
"include": [
"src",
],
}
If I leave the file as-is, and move it to ./
, then it cannot find any inputs, presumably because it is looking for ./src
which doesn’t exist.
I would love to create a ./tsconfig.json
like this:
{
"compilerOptions": {
"strict": true,
"outDir": "$PWD/dist",
"declaration": true,
"declarationDir": "$PWD/types",
},
"include": [
"$PWD/src",
],
}
Unfortunately, I get this error:
error TS18003: No inputs were found in config file '/<my_path>/tsconfig.json'. Specified 'include' paths were '["$PWD/src"]' and 'exclude' paths were '["$PWD/dist","$PWD/types"]'.
Is there a way I can have the paths within tsconfig auto-expand to whatever directory I’m working in or otherwise use a single tsconfig file for all my projects?