From 8114f6e8c15242900f4a1ba7842d973d6755ce07 Mon Sep 17 00:00:00 2001 From: uhyo Date: Fri, 3 Nov 2023 21:49:48 +0900 Subject: [PATCH 1/3] empty commit From 88805951dbcf72aade3055696947001edb2a41cc Mon Sep 17 00:00:00 2001 From: uhyo Date: Fri, 3 Nov 2023 21:49:38 +0900 Subject: [PATCH 2/3] fix import.meta.url transformed by ourselves when testing --- src/node.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/node.ts b/src/node.ts index ae6f5b1..7167207 100644 --- a/src/node.ts +++ b/src/node.ts @@ -112,7 +112,9 @@ export function register(esbuildOptions: RegisterOptions = {}) { const compile: COMPILE = function compile(code, filename, format) { const define = { - 'import.meta.url': IMPORT_META_URL_VARIABLE_NAME, + // Computed property name is used because literally writing + // `import.meta.url` may be transformed by esbuild-register itself + ['IMPORT.META.URL'.toLowerCase()]: IMPORT_META_URL_VARIABLE_NAME, ...overrides.define, } const banner = `const ${IMPORT_META_URL_VARIABLE_NAME} = require('url').pathToFileURL(__filename).href;${ From 5ba6c54a337f3eff8539af51f6a19cafec77221a Mon Sep 17 00:00:00 2001 From: uhyo Date: Sat, 4 Nov 2023 14:29:15 +0900 Subject: [PATCH 3/3] fix comment --- src/node.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/node.ts b/src/node.ts index 7167207..b5ff77d 100644 --- a/src/node.ts +++ b/src/node.ts @@ -113,7 +113,7 @@ export function register(esbuildOptions: RegisterOptions = {}) { const compile: COMPILE = function compile(code, filename, format) { const define = { // Computed property name is used because literally writing - // `import.meta.url` may be transformed by esbuild-register itself + // `import.meta.url` may be transformed during our build process ['IMPORT.META.URL'.toLowerCase()]: IMPORT_META_URL_VARIABLE_NAME, ...overrides.define, }