From db35f22083b0ed89e8c7b5b80e6e205ec2b7dd19 Mon Sep 17 00:00:00 2001 From: Christian Bromann Date: Fri, 15 Jul 2022 11:50:11 +0200 Subject: [PATCH 1/3] Don't call transform on file urls --- lib/nodejs/esm-utils.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/nodejs/esm-utils.js b/lib/nodejs/esm-utils.js index 18abe81ff8..269179c7c0 100644 --- a/lib/nodejs/esm-utils.js +++ b/lib/nodejs/esm-utils.js @@ -88,7 +88,10 @@ function dealWithExports(module) { exports.loadFilesAsync = async (files, preLoadFunc, postLoadFunc) => { for (const file of files) { preLoadFunc(file); - const result = await exports.requireOrImport(path.resolve(file)); + const filePath = file.startsWith('file://') + ? file + : path.resolve(file) + const result = await exports.requireOrImport(filePath); postLoadFunc(file, result); } }; From 0d9992ae0fff377fbcc70ff2b0766694cd023314 Mon Sep 17 00:00:00 2001 From: Christian Bromann Date: Tue, 19 Jul 2022 12:26:45 +0200 Subject: [PATCH 2/3] make prettier happy --- lib/nodejs/esm-utils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/nodejs/esm-utils.js b/lib/nodejs/esm-utils.js index 269179c7c0..828e2e5697 100644 --- a/lib/nodejs/esm-utils.js +++ b/lib/nodejs/esm-utils.js @@ -90,7 +90,7 @@ exports.loadFilesAsync = async (files, preLoadFunc, postLoadFunc) => { preLoadFunc(file); const filePath = file.startsWith('file://') ? file - : path.resolve(file) + : path.resolve(file); const result = await exports.requireOrImport(filePath); postLoadFunc(file, result); } From c59ff23e51d2732b2058fc1ee6962309fe8eb947 Mon Sep 17 00:00:00 2001 From: Christian Bromann Date: Fri, 6 Jan 2023 18:35:04 +0100 Subject: [PATCH 3/3] Update lib/nodejs/esm-utils.js --- lib/nodejs/esm-utils.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/nodejs/esm-utils.js b/lib/nodejs/esm-utils.js index 828e2e5697..cfe7b54dac 100644 --- a/lib/nodejs/esm-utils.js +++ b/lib/nodejs/esm-utils.js @@ -88,9 +88,7 @@ function dealWithExports(module) { exports.loadFilesAsync = async (files, preLoadFunc, postLoadFunc) => { for (const file of files) { preLoadFunc(file); - const filePath = file.startsWith('file://') - ? file - : path.resolve(file); + const filePath = file.startsWith('file://') ? file : path.resolve(file); const result = await exports.requireOrImport(filePath); postLoadFunc(file, result); }