Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support aliasing dependencies #89

Closed
lucacasonato opened this issue Jul 30, 2021 · 9 comments
Closed

Support aliasing dependencies #89

lucacasonato opened this issue Jul 30, 2021 · 9 comments

Comments

@lucacasonato
Copy link
Contributor

For example:

https://esm.sh/swr?alias=react:preact/compat

And in combination with ?deps:

https://esm.sh/swr?alias=react:preact/compat&deps=preact@10.5.14

Especially useful for react -> preact :-)

Also, do you accept sponsorship anywhere?

@ije
Copy link
Member

ije commented Jul 30, 2021

@lucacasonato thanks, it is a great idea, i will add this feature in few days! and thanks vary much for the kind sponsorship ask but i can't accept it since github Sponsors doesn't work in my country :(

@lucacasonato
Copy link
Contributor Author

can't accept it since github Sponsors doesn't work in my country :(

Aw, that's very unfortunate. If I can help out in any other way (hosting infrastructure cost for example), please hit me up on Discord. And once Sponsors becomes available on your country, please ping me!

@shadowtime2000
Copy link

Could be possible expanded to have official deno packages used.

https://esm.sh/autoprefixer?alias=postcss:https://deno.land/x/postcss@8.2.0/mod.ts

@ije
Copy link
Member

ije commented Aug 7, 2021

@lucacasonato @shadowtime2000 Aliasing can work now, pls try https://esm.sh/swr?alias=react:preact/compat

@mashaal
Copy link
Contributor

mashaal commented Aug 7, 2021

@ije This looks like it's broken deps in my projects.

https://esm.sh/wouter?deps=react@alpha

/* esm.sh - wouter@2.7.4 */
export * from "https://cdn.esm.sh/v44/wouter@2.7.4/X-ZGVwczpyZWFjdEAxOC4wLjAtYWxwaGEtYjk5MzRkNmRiLTIwMjEwODA1/es2021/wouter.js";
export { default } from "https://cdn.esm.sh/v44/wouter@2.7.4/X-ZGVwczpyZWFjdEAxOC4wLjAtYWxwaGEtYjk5MzRkNmRiLTIwMjEwODA1/es2021/wouter.js";

I might be remembering incorrectly, but I thought deps was passed into the exports in these statements: ie: v44/wouter?deps=react@alpha?

@ije
Copy link
Member

ije commented Aug 7, 2021

@mashaal alias is different with deps, it is used to replace deps as Luca asked, you can use the deps as before that allows you control the dependencies with specific version

@ije
Copy link
Member

ije commented Aug 7, 2021

but yes the CDN URL is changed when you passed ?deps

@ije
Copy link
Member

ije commented Sep 8, 2021

i am going to close this since we have implemented this feature in v44, thanks a lot @lucacasonato

@ije ije closed this as completed Sep 8, 2021
@TomokiMiyauci
Copy link

Can I specify aliases for the dependency of dependency?

Example:

graphiql
deps:

  • @graphiql/react
  • react
  • react-dom
    ...and more

@graphiql/react
deps:

  • react
  • react-dom
    ...and more
import GraphiQL from "https://esm.sh/graphiql?alias=react:preact/compat,react-dom:preact/compat";

Or you may need the scope of the alias.

import GraphiQL from "https://esm.sh/graphiql?alias=react:preact/compat,react-dom:preact/compat,@graphiql/react^react:preact/compat";

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants