From 94824eb824ba739ab0a76de394756957df2d8cdd Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Sat, 5 Mar 2022 21:21:38 +0000 Subject: [PATCH 1/2] fix: don't cache resolved config file --- src/loader.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/loader.ts b/src/loader.ts index 0b41117..27d128c 100644 --- a/src/loader.ts +++ b/src/loader.ts @@ -161,6 +161,7 @@ async function resolveConfig (source: string, opts: LoadConfigOptions): Promise< const res: ResolvedConfig = { config: {}, cwd } try { res.configFile = jiti.resolve(resolve(cwd, source), { paths: [cwd] }) + delete jiti.cache[res.configFile] res.config = jiti(res.configFile) if (typeof res.config === 'function') { res.config = await res.config() From 226fbc35e532e19467680f5e822a7e6d825a6b7f Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Mon, 7 Mar 2022 10:48:47 +0000 Subject: [PATCH 2/2] refactor: disable `requireCache` --- src/loader.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/loader.ts b/src/loader.ts index 27d128c..f318aa9 100644 --- a/src/loader.ts +++ b/src/loader.ts @@ -135,7 +135,7 @@ async function extendConfig (config, opts: LoadConfigOptions) { const GIT_PREFIXES = ['github:', 'gitlab:', 'bitbucket:', 'https://'] -const jiti = createJiti(null, { cache: false, interopDefault: true }) +const jiti = createJiti(null, { cache: false, interopDefault: true, requireCache: false }) async function resolveConfig (source: string, opts: LoadConfigOptions): Promise { if (opts.resolve) { @@ -161,7 +161,6 @@ async function resolveConfig (source: string, opts: LoadConfigOptions): Promise< const res: ResolvedConfig = { config: {}, cwd } try { res.configFile = jiti.resolve(resolve(cwd, source), { paths: [cwd] }) - delete jiti.cache[res.configFile] res.config = jiti(res.configFile) if (typeof res.config === 'function') { res.config = await res.config()