You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
we have a monorepo with a lot of packages, and some things, including our base tsconfig.json that we extend in all other packages, are installed in the root node_modules.
Currently tsconfig-paths is only searching for the "extends" file in the node_modules next to the original tsconfig.file.
I don't have capacity right now for a proper PR, but I made a pnpm patch that solves the issue for us.
I hope it'll be useful for someone in the meantime:
diff --git a/lib/tsconfig-loader.js b/lib/tsconfig-loader.js
index d298653fa4119fff689d60cce11cce73bb801420..619a374585119e37154393b7b63c6b14e88857eb 100644
--- a/lib/tsconfig-loader.js+++ b/lib/tsconfig-loader.js@@ -107,7 +107,18 @@ existsSync, readFileSync) {
if (extendedConfig.indexOf("/") !== -1 &&
extendedConfig.indexOf(".") !== -1 &&
!existsSync(extendedConfigPath)) {
- extendedConfigPath = path.join(currentDir, "node_modules", extendedConfig);+ var lookupDir = currentDir;+ while(existsSync(lookupDir)) {+ extendedConfigPath = path.join(lookupDir, "node_modules", extendedConfig);+ if(existsSync(extendedConfigPath)) {+ break;+ }+ var nextDir = path.normalize(path.resolve(lookupDir, '..'));+ if(nextDir === lookupDir){+ break;+ }+ lookupDir = nextDir;+ }
}
var base = loadTsconfig(extendedConfigPath, existsSync, readFileSync) || {};
// baseUrl should be interpreted as relative to the base tsconfig,
The text was updated successfully, but these errors were encountered:
This definitely is missing from tsconfig-paths. We have a slightly different use case where base tsconfigs are not in the monorepo root but in a package called tsconfig, so extends looks like this in a workspace's tsconfig:
In above example we extend from a preset called "nodejs" which in turn extends from a base, where all path mappings internal to the monorepo reside. I wish tsconfig-paths resolved those too.
Hi,
we have a monorepo with a lot of packages, and some things, including our base
tsconfig.json
that we extend in all other packages, are installed in the rootnode_modules
.Currently
tsconfig-paths
is only searching for the "extends" file in thenode_modules
next to the originaltsconfig.file
.I don't have capacity right now for a proper PR, but I made a
pnpm patch
that solves the issue for us.I hope it'll be useful for someone in the meantime:
The text was updated successfully, but these errors were encountered: