skypackjs / skypack-cdn

An issue tracker for the CDN
107 stars 5 forks source link

npm package aliases don't work #337

Open epicfaace opened 1 year ago

epicfaace commented 1 year ago

Package aliases don't work for npm.

For example, if I have a package that aliases "ajv" to "ajv8":

"dependencies": {
    "ajv8": "npm:ajv@^8.11.0"
}

Then, when I try to import the package on skypack, skypack looks through skypack for a package with that specific alias, e.g. "ajv8", when really, it should be resolving the alias and looking for "ajv" instead:

image image image

Here's a concrete example using @rjsf/validator-ajv8: https://codepen.io/epicfaace/pen/ZEjLxMV. You can run it and then view the js console to see the error.

And here's the alias code in that package:

https://github.com/rjsf-team/react-jsonschema-form/blob/ff034df8f6b7080bf76b7f25e0b1f400fbc818e5/packages/validator-ajv8/package.json#L31