diff options
author | David Sherret <dsherret@users.noreply.github.com> | 2024-08-20 16:32:01 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-20 16:32:01 -0400 |
commit | 37279e0b0a4300318da472bf0a8bdb894746537f (patch) | |
tree | fffc0425e931f70e8297456ddbf7b106fb72e9e9 /cli/tools/registry/pm.rs | |
parent | a7c002ae634b20a2f84c90417327a88c9ac2df99 (diff) |
fix(add): error when config file contains importMap field (#25115)
The "imports" field has higher precedence than "importMap", so we should
error when `deno add` goes to add an `"imports"` field.
Closes https://github.com/denoland/deno/issues/24264
Closes https://github.com/denoland/deno/pull/24478
Diffstat (limited to 'cli/tools/registry/pm.rs')
-rw-r--r-- | cli/tools/registry/pm.rs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/cli/tools/registry/pm.rs b/cli/tools/registry/pm.rs index 52f3310ba..3cdef071f 100644 --- a/cli/tools/registry/pm.rs +++ b/cli/tools/registry/pm.rs @@ -289,6 +289,17 @@ pub async fn add( _ => bail!("Failed updating config file due to no object."), }; + if obj.get_string("importMap").is_some() { + bail!( + concat!( + "`deno add` is not supported when configuration file contains an \"importMap\" field. ", + "Inline the import map into the Deno configuration file.\n", + " at {}", + ), + config_specifier + ); + } + let mut existing_imports = config_file.existing_imports()?; let is_npm = config_file.is_npm(); |