From 8a719ad598a1e1a2c3eff1fc1fa6473cc58c34c4 Mon Sep 17 00:00:00 2001 From: chengzhuo5 <42364602+chengzhuo5@users.noreply.github.com> Date: Mon, 31 Jul 2023 13:36:32 +0800 Subject: [PATCH] fix: compatible with `true` type `parserOptions.project` (#12) Co-authored-by: JounQin --- src/ExportMap.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/ExportMap.js b/src/ExportMap.js index f41615d13f..8e4fc697ae 100644 --- a/src/ExportMap.js +++ b/src/ExportMap.js @@ -561,7 +561,7 @@ ExportMap.parse = function (path, content, context) { if (project) { const projects = Array.isArray(project) ? project : [project]; for (const project of projects) { - tsconfigResult = getTsconfig(pathResolve(tsconfigRootDir, project)); + tsconfigResult = getTsconfig(project === true ? context.filename : pathResolve(tsconfigRootDir, project)); if (tsconfigResult) { break; } @@ -800,6 +800,13 @@ function childContext(path, context) { parserOptions, parserPath, path, + filename: typeof context.getPhysicalFilename === 'function' + ? context.getPhysicalFilename() + : context.physicalFilename != null + ? context.physicalFilename + : typeof context.getFilename === 'function' + ? context.getFilename() + : context.filename, }; }