fix(deno_facade): allow non-MainModule resolution when referrer is "."#704
fix(deno_facade): allow non-MainModule resolution when referrer is "."#7040x5457 wants to merge 1 commit into
Conversation
|
Hello @0x5457 😋 Have you tried running I think this change is acceptable, but do you have any special comments regarding the above? |
|
Hi @nyannyacha, thanks for the review! I haven't tried deno compile on v2.1.4 directly, but I noticed that upstream Deno hit the same issue and fixed it in denoland/deno#28379. That PR removes the exact same |
What kind of change does this PR introduce?
Bug fix
What is the current behavior?
EmbeddedModuleLoader::resolverejects any resolution wherereferrer == "."unless
kind == ResolutionKind::MainModule:This breaks Deno's CJS→ESM bridge. When a CommonJS module synchronously
require()s a pure-ESM module,loadESMFromCJSre-entersresolvewithResolutionKind::Importand the same"."referrer, and the worker bootswith:
fix #703
What is the new behavior?
After the fix,
require("./message.mjs")andrequire("chalk")(a"type": "module"package) both load correctly from a CJS entrypoint.