Import Maps don't support package address targets with query parameters
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
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.
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
use
{
"imports": {
"@mui/": "https://esm.sh/@mui/[email protected]&alias=react:preact/compat,react/jsx-runtime:preact/compat/jsx-runtime&[email protected]/"
}
}
instead