diff options
Diffstat (limited to 'cli/module_graph.rs')
-rw-r--r-- | cli/module_graph.rs | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/cli/module_graph.rs b/cli/module_graph.rs index 3a59a537d..be3bd2884 100644 --- a/cli/module_graph.rs +++ b/cli/module_graph.rs @@ -196,6 +196,7 @@ impl ModuleGraphLoader { let (import_descs, ref_descs) = analyze_dependencies_and_references( &specifier, + map_file_extension(&PathBuf::from(&specifier)), &source_code, self.analyze_dynamic_imports, )?; @@ -409,6 +410,7 @@ impl ModuleGraphLoader { let (import_descs, ref_descs) = analyze_dependencies_and_references( &module_specifier.to_string(), + source_file.media_type, &source_code, self.analyze_dynamic_imports, )?; @@ -786,4 +788,23 @@ mod tests { ); drop(http_server_guard); } + + #[tokio::test] + async fn source_graph_different_langs() { + let http_server_guard = crate::test_util::http_server(); + + // ModuleGraphLoader was mistakenly parsing this file as TSX + // https://github.com/denoland/deno/issues/5867 + + let module_specifier = ModuleSpecifier::resolve_url_or_path( + "http://localhost:4545/cli/tests/ts_with_generic.ts", + ) + .unwrap(); + + build_graph(&module_specifier) + .await + .expect("Failed to build graph"); + + drop(http_server_guard); + } } |