import_map icon indicating copy to clipboard operation
import_map copied to clipboard

Import Maps don't support package address targets with query parameters

Open NicolaiSchmid opened this issue 3 years ago • 4 comments

Reproduce:

  • Deno v1.23.3
  • import_map.json:
{
  "imports": {
      "@mui/": "https://esm.sh/@mui/[email protected]/?alias=react:preact/compat,react/jsx-runtime:preact/compat/jsx-runtime&[email protected]"
  }
}

Deno then reports back with:

Package address targets must end with "/".

I couldn't find a current code snippet, but for version 1.9.1 I found this check, which doesn't account for esm.sh alias feature, because it just checks the last character of the value string.

If you have any further questions, please let me know

NicolaiSchmid avatar Jul 24 '22 15:07 NicolaiSchmid

I am not sure what the spec says about handling query parameters in targets. If it is allowed, I suspect we need to change how we resolve specifiers to preserve the query paramaters.

kitsonk avatar Jul 25 '22 00:07 kitsonk

It was mentioned as a solution/workaround here https://github.com/denoland/fresh/issues/411#issuecomment-1177462538 and is documented beneath the "Aliasing dependencies" headline directly on esm.sh

NicolaiSchmid avatar Jul 25 '22 09:07 NicolaiSchmid

use

{
  "imports": {
      "@mui/": "https://esm.sh/@mui/[email protected]&alias=react:preact/compat,react/jsx-runtime:preact/compat/jsx-runtime&[email protected]/"
  }
}

instead

ije avatar Mar 06 '23 03:03 ije