I have several projects each with their own tsconfig.json
files and other configuration files, and my aim is to use the same configurations across all of them.
To accomplish this, I decided to create an npm package called config
, which contains a standardized tsconfig.json
file and other necessary .json
config files.
Previously, my TypeScript build command was
tsc -p tsconfig.json --incremental
, but I attempted to change it to tsc -p tsconfig.js --incremental
by creating a tsconfig.js
file that looks like this:
module.exports = {
...require('./node_modules/@myOrg/myPackage/tsconfig.json')
};
I used spread syntax to override certain properties if needed. However, despite the validity of my approach, it did not work as intended. The compilation failed when using tsc with this configuration file because it was excluding important properties from the original tsconfig.json
(such as esModuleInterop
, downlevelIteration
, es2015
, etc...) present in the package's tsconfig.json
.
How can I accomplish my goal? While this technique may work for other .json
config files, it seems insufficient for tsconfig.json
due to certain required flags.