From 21b23d64aa77ce99cd97798af30b242291bf4ef5 Mon Sep 17 00:00:00 2001 From: iarroyo Date: Wed, 8 Jan 2025 16:15:42 +0100 Subject: [PATCH] Suppress exception thrown by require.resolve if the file does not exist --- packages/core/src/config/loader.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/core/src/config/loader.ts b/packages/core/src/config/loader.ts index 48893dab..f00086fa 100644 --- a/packages/core/src/config/loader.ts +++ b/packages/core/src/config/loader.ts @@ -85,7 +85,11 @@ function loadConfigInput(ts: TypeScript, entryPath: string): GlintConfigInput | if (currentContents.extends) { currentPath = path.resolve(path.dirname(currentPath), currentContents.extends); if (!fs.existsSync(currentPath)) { - currentPath = require.resolve(currentContents.extends); + try { + currentPath = require.resolve(currentContents.extends); + } catch { + // suppress the exception thrown by require.resolve for those scenarios where the file does not exist + } } } else { currentPath = undefined;