summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cli/args/mod.rs23
1 files changed, 23 insertions, 0 deletions
diff --git a/cli/args/mod.rs b/cli/args/mod.rs
index 1e0c72b1c..e46313858 100644
--- a/cli/args/mod.rs
+++ b/cli/args/mod.rs
@@ -420,6 +420,10 @@ fn resolve_import_map_specifier(
// and with config files, we support both local and remote config files,
// so we have treat them differently.
if let Some(import_map_path) = config_file.to_import_map_path() {
+ // if the import map is an absolute URL, use it as is
+ if let Ok(specifier) = deno_core::resolve_url(&import_map_path) {
+ return Ok(Some(specifier));
+ }
let specifier =
// with local config files, it might be common to specify an import
// map like `"importMap": "import-map.json"`, which is resolvable if
@@ -472,6 +476,25 @@ mod test {
}
#[test]
+ fn resolve_import_map_remote_config_file_local() {
+ let config_text = r#"{
+ "importMap": "https://example.com/import_map.json"
+ }"#;
+ let config_specifier =
+ ModuleSpecifier::parse("file:///deno/deno.jsonc").unwrap();
+ let config_file = ConfigFile::new(config_text, &config_specifier).unwrap();
+ let actual = resolve_import_map_specifier(None, Some(&config_file));
+ assert!(actual.is_ok());
+ let actual = actual.unwrap();
+ assert_eq!(
+ actual,
+ Some(
+ ModuleSpecifier::parse("https://example.com/import_map.json").unwrap()
+ )
+ );
+ }
+
+ #[test]
fn resolve_import_map_config_file_remote() {
let config_text = r#"{
"importMap": "./import_map.json"