diff options
author | bartOssh <lenart.consulting@gmail.com> | 2020-09-23 13:56:16 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-23 13:56:16 +0200 |
commit | 29dd62b08cc1a6a95b242b7269fe1b8deefa7a24 (patch) | |
tree | 2dbbc3135d1281adc5645adc8cc7c79faf3e3f72 /cli | |
parent | 8a6a3904574375e109ef98aaa07af11a9c994b89 (diff) |
fix(watch): watch importmap file for changes (#7580)
Diffstat (limited to 'cli')
-rw-r--r-- | cli/main.rs | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/cli/main.rs b/cli/main.rs index e2b61d33a..a7ca754c7 100644 --- a/cli/main.rs +++ b/cli/main.rs @@ -480,13 +480,21 @@ async fn run_with_watch(flags: Flags, script: String) -> Result<(), AnyError> { let module_graph = module_graph_loader.get_graph(); // Find all local files in graph - let paths_to_watch: Vec<PathBuf> = module_graph + let mut paths_to_watch: Vec<PathBuf> = module_graph .values() .map(|f| Url::parse(&f.url).unwrap()) .filter(|url| url.scheme() == "file") .map(|url| url.to_file_path().unwrap()) .collect(); + if let Some(import_map) = global_state.flags.import_map_path.clone() { + paths_to_watch.push( + Url::parse(&format!("file://{}", &import_map))? + .to_file_path() + .unwrap(), + ); + } + // FIXME(bartlomieju): new file watcher is created on after each restart file_watcher::watch_func(&paths_to_watch, move || { // FIXME(bartlomieju): GlobalState must be created on each restart - otherwise file fetcher |