mirror of
https://github.com/denoland/deno.git
synced 2025-08-04 02:48:24 +00:00
fix(compat): cjs/esm interop for dynamic imports (#13792)
This commit fixes CJS/ESM interop in compat mode for dynamically imported modules. "ProcState::prepare_module_load" was changed to accept a list of "graph roots" without associated "module kind". That module kind was always hardcoded to "ESM" which is not true for CJS/ESM interop - a CommonJs module might be imported using "import()" function. In such case the root of the graph should have "CommonJs" module kind instead of "ESM".
This commit is contained in:
parent
8db3a9546b
commit
808f797633
6 changed files with 48 additions and 11 deletions
|
@ -108,7 +108,7 @@ impl ModuleLoader for CliModuleLoader {
|
|||
|
||||
async move {
|
||||
ps.prepare_module_load(
|
||||
vec![(specifier, deno_graph::ModuleKind::Esm)],
|
||||
vec![specifier],
|
||||
is_dynamic,
|
||||
lib,
|
||||
root_permissions,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue