My team is maintaining multiple packages and we are trying to create a shared tsconfig.json with common configuration for all of them. It contains our preferences about compile target, JSX, output directory and included files, for example:
{
"compilerOptions": {
"module": "esnext",
"target": "es5",
"lib": ["es5", "dom"],
"jsx": "react",
"outDir": "build/dist"
},
"include": ["./src/**/*.ts", "./src/**/*.tsx"]
}
We publish this file as a shared npm-module, like my-build-config and then use extends in every project:
{
"extends": "./node_modules/my-build-config/tsconfig.json"
}
The issue here is that all paths in the shared config are relative to the file location. E.g. it will try to include ".ts" files not from the current project, but inside my-build-config. For example, instead of ./src/index.ts it looks for ./node_modules/my-build-config/src/index.ts.
Is there a way to share file locations, so they will not be repeated in 10+ packages? Maybe something similar what Jest does with rootDir property.