From 1312a57984d9c058e257286ea4b93dec89b3a5de Mon Sep 17 00:00:00 2001 From: Nayeem Rahman Date: Sun, 4 Apr 2021 12:26:00 +0100 Subject: fix: Properly await already evaluating dynamic imports (#9984) --- core/runtime.rs | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'core') diff --git a/core/runtime.rs b/core/runtime.rs index f358cf05e..04c6ca1af 100644 --- a/core/runtime.rs +++ b/core/runtime.rs @@ -784,15 +784,9 @@ impl JsRuntime { module.get_status() }; - // Since the same module might be dynamically imported more than once, - // we short-circuit is it is already evaluated. - if status == v8::ModuleStatus::Evaluated { - self.dyn_import_done(load_id, id); - return Ok(()); - } - - if status != v8::ModuleStatus::Instantiated { - return Ok(()); + match status { + v8::ModuleStatus::Instantiated | v8::ModuleStatus::Evaluated => {} + _ => return Ok(()), } // IMPORTANT: Top-level-await is enabled, which means that return value -- cgit v1.2.3