deno
fb78add1 - fix(core): allow dynamic imports during cached module evaluation (#36258)

Commit
21 days ago
fix(core): allow dynamic imports during cached module evaluation (#36258) Fixes #36216 ## Summary Release the `ModuleMapData` borrow before evaluating a cached module in the synthetic ESM fast path. This allows evaluated module code to start a dynamic import without re-entering the same `RefCell` while it is still borrowed. Add a minimal regression test using a pre-instantiated module cached under a synthetic ESM specifier whose body starts a dynamic import. ## Root cause The cache-hit path kept an immutable `ModuleMapData` borrow alive across `module.evaluate()`. Starting a dynamic import synchronously allocates a new module load ID, which requires a mutable borrow of the same map and caused a `RefCell already borrowed` panic. ## Validation - `./tools/format.js --check` - `cargo test -p deno_core --lib` (443 passed, 2 ignored) - `cargo clippy -p deno_core --tests -- -D warnings`
Author
Parents
Loading