From a756405b75a5ea7176f6bc2d81cf6f076456eefa Mon Sep 17 00:00:00 2001 From: michael hancock Date: Wed, 6 Oct 2021 21:17:22 +0200 Subject: [PATCH] feat: support extends fron node_modules --- src/util.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/util.ts b/src/util.ts index c59972f..b2425ae 100644 --- a/src/util.ts +++ b/src/util.ts @@ -59,7 +59,14 @@ export const loadConfig = (file: string): ITSConfig => { } if (ext) { - const parentConfig = loadConfig(resolve(dirname(file), ext)); + let extPath = path.resolve(path.dirname(file),ext) + // try load file relative to node_modules to support extending from npm packages + // eg: https://github.com/tsconfig/bases + + if(!fs.existsSync(extPath)){ + extPath = path.resolve(__dirname.split("node_modules")[0],"node_modules",ext) + } + const parentConfig = loadConfig(extPath); return { ...parentConfig, ...config,