Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove support for import.meta.resolve #237

Merged
merged 8 commits into from
Sep 7, 2023

Conversation

iambumblehead
Copy link
Owner

closes #234

removes support for import.meta.resolve

@iambumblehead
Copy link
Owner Author

diff --git a/src/esmockLoader.js b/src/esmockLoader.js
index 05075c1..d629eb8 100644
--- a/src/esmockLoader.js
+++ b/src/esmockLoader.js
@@ -148,11 +148,13 @@ const load = async (url, context, nextLoad) => {
         ? `const {${importedNames}} = require('${specifier}');`
         : `import {${importedNames}} from '${specifier}';`
 
-      return {
-        format: nextLoadRes.format,
-        shortCircuit: true,
-        responseURL: encodeURI(url),
-        source: hbang + importexpr + sourcesafe
+      if (nextLoadRes.format !== 'commonjs') {
+        return {
+          format: nextLoadRes.format,
+          shortCircuit: true,
+          responseURL: encodeURI(url),
+          source: hbang + importexpr + sourcesafe
+        }
       }
     }
   }

node v20.6 is having issues resolving some CJS modules

@iambumblehead
Copy link
Owner Author

iambumblehead commented Sep 7, 2023

for the failing mixed esm/cjs global import test, I am so far unable to resolve the issue or simplify to anything smaller.

@iambumblehead iambumblehead requested a review from koshic September 7, 2023 06:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Breakage in Node.js v20.6.0
3 participants