diff options
Diffstat (limited to 'cli/main.rs')
-rw-r--r-- | cli/main.rs | 31 |
1 files changed, 26 insertions, 5 deletions
diff --git a/cli/main.rs b/cli/main.rs index 5985a1040..68ba5e776 100644 --- a/cli/main.rs +++ b/cli/main.rs @@ -72,10 +72,12 @@ use crate::file_fetcher::SourceFile; use crate::file_fetcher::SourceFileFetcher; use crate::fs as deno_fs; use crate::global_state::GlobalState; +use crate::import_map::ImportMap; use crate::msg::MediaType; use crate::op_error::OpError; use crate::ops::io::get_stdio; use crate::permissions::Permissions; +use crate::state::exit_unstable; use crate::state::State; use crate::tsc::TargetLib; use crate::worker::MainWorker; @@ -396,12 +398,31 @@ async fn bundle_command( module_name = ModuleSpecifier::from(u) } - let global_state = GlobalState::new(flags)?; debug!(">>>>> bundle START"); - let bundle_result = global_state - .ts_compiler - .bundle(global_state.clone(), module_name, out_file) - .await; + let compiler_config = tsc::CompilerConfig::load(flags.config_path.clone())?; + + let maybe_import_map = match flags.import_map_path.as_ref() { + None => None, + Some(file_path) => { + if !flags.unstable { + exit_unstable("--importmap") + } + Some(ImportMap::load(file_path)?) + } + }; + + let global_state = GlobalState::new(flags)?; + + let bundle_result = tsc::bundle( + &global_state, + compiler_config, + module_name, + maybe_import_map, + out_file, + global_state.flags.unstable, + ) + .await; + debug!(">>>>> bundle END"); bundle_result } |