mirror of
https://github.com/denoland/deno.git
synced 2024-12-22 15:24:46 -05:00
fix(watch): watch importmap file for changes (#7580)
This commit is contained in:
parent
8a6a390457
commit
29dd62b08c
1 changed files with 9 additions and 1 deletions
10
cli/main.rs
10
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();
|
let module_graph = module_graph_loader.get_graph();
|
||||||
|
|
||||||
// Find all local files in 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()
|
.values()
|
||||||
.map(|f| Url::parse(&f.url).unwrap())
|
.map(|f| Url::parse(&f.url).unwrap())
|
||||||
.filter(|url| url.scheme() == "file")
|
.filter(|url| url.scheme() == "file")
|
||||||
.map(|url| url.to_file_path().unwrap())
|
.map(|url| url.to_file_path().unwrap())
|
||||||
.collect();
|
.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
|
// FIXME(bartlomieju): new file watcher is created on after each restart
|
||||||
file_watcher::watch_func(&paths_to_watch, move || {
|
file_watcher::watch_func(&paths_to_watch, move || {
|
||||||
// FIXME(bartlomieju): GlobalState must be created on each restart - otherwise file fetcher
|
// FIXME(bartlomieju): GlobalState must be created on each restart - otherwise file fetcher
|
||||||
|
|
Loading…
Reference in a new issue