From 78c82976528c5896b20029938f02b34f10efae3f Mon Sep 17 00:00:00 2001 From: marcopiraccini Date: Thu, 9 May 2024 16:06:26 +0200 Subject: [PATCH] Import always a fresh generator Signed-off-by: marcopiraccini --- src/main/lib/import-or-local.mjs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/lib/import-or-local.mjs b/src/main/lib/import-or-local.mjs index 044db752..a326c4f8 100644 --- a/src/main/lib/import-or-local.mjs +++ b/src/main/lib/import-or-local.mjs @@ -19,14 +19,16 @@ async function importOrLocal ({ projectDir, pkg, logger }) { try { const fileToImport = _require.resolve(pkg) - return await import(pathToFileURL(fileToImport)) + const fileToImportUrl = `${pathToFileURL(fileToImport)}?update=${Date.now()}` + return await import(fileToImportUrl) } catch (err) {} await npmInstall(pkg, { cwd: projectDir }, logger) logger.info({ name: pkg, path: projectDir }, 'Installed!') const fileToImport = _require.resolve(pkg) - return await import(pathToFileURL(fileToImport)) + const fileToImportUrl = `${pathToFileURL(fileToImport)}?update=${Date.now()}` + return await import(fileToImportUrl) } }