From f4170bbb76080e755070d7aed5520b309b2c9203 Mon Sep 17 00:00:00 2001 From: Lukas Kreussel <65088241+LLukas22@users.noreply.github.com> Date: Fri, 27 Sep 2024 14:56:24 +0200 Subject: [PATCH] Falback to `file://` path --- core/config/load.ts | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/core/config/load.ts b/core/config/load.ts index 95fc73053..4388d94b0 100644 --- a/core/config/load.ts +++ b/core/config/load.ts @@ -595,7 +595,20 @@ async function loadFullConfigNode( try { // Try config.ts first const configJsPath = getConfigJsPath(); - const module = await import(configJsPath); + let module: any; + + try { + module = await import(configJsPath); + } catch (e) { + console.log(e) + console.log("Could not load config.ts as absolute path, retrying as file url ..."); + try { + module = await import(`file://${configJsPath}`); + } catch (e) { + throw new Error("Could not load config.ts as file url either", { cause: e }); + } + } + if (typeof require !== "undefined") { delete require.cache[require.resolve(configJsPath)]; }