From 63a821b78b5a293c0eb5b3ecc18d67bde8331eda Mon Sep 17 00:00:00 2001 From: Kitson Kelly Date: Tue, 15 Dec 2020 16:52:55 +1100 Subject: fix(cli): make dynamic import errors catchable (#8750) Fixes #6259 --- cli/module_loader.rs | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) (limited to 'cli/module_loader.rs') diff --git a/cli/module_loader.rs b/cli/module_loader.rs index da75b8510..aab951c4a 100644 --- a/cli/module_loader.rs +++ b/cli/module_loader.rs @@ -94,26 +94,14 @@ impl ModuleLoader for CliModuleLoader { maybe_referrer: Option, _is_dynamic: bool, ) -> Pin> { - let module_specifier = module_specifier.to_owned(); - let module_url_specified = module_specifier.to_string(); + let module_specifier = module_specifier.clone(); let program_state = self.program_state.clone(); // NOTE: this block is async only because of `deno_core` // interface requirements; module was already loaded // when constructing module graph during call to `prepare_load`. - let fut = async move { - let compiled_module = program_state - .fetch_compiled_module(module_specifier, maybe_referrer)?; - Ok(deno_core::ModuleSource { - // Real module name, might be different from initial specifier - // due to redirections. - code: compiled_module.code, - module_url_specified, - module_url_found: compiled_module.name, - }) - }; - - fut.boxed_local() + async move { program_state.load(module_specifier, maybe_referrer) } + .boxed_local() } fn prepare_load( -- cgit v1.2.3