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

CJS to ESM conversion support for GitHub #18506

Open
2 tasks done
KaKi87 opened this issue Jun 19, 2023 · 2 comments
Open
2 tasks done

CJS to ESM conversion support for GitHub #18506

KaKi87 opened this issue Jun 19, 2023 · 2 comments

Comments

@KaKi87
Copy link

KaKi87 commented Jun 19, 2023

Is your feature request related to a problem? Please describe.

Just like CJS packages are distributed via NPM, some are distributed via GitHub.

Describe the solution you would like.

Just like jsDelivr supports converting NPM packages from CJS to ESM, it could support converting GitHub packages from CJS to ESM, i.e. : https://cdn.jsdelivr.net/gh/user/repo@version/file/+esm

Describe alternatives you have considered.

None

Requisites

  • I performed a cursory search of the issue tracker to avoid opening a duplicate issue.
  • I understand that not filling out this template correctly will lead to the issue being closed.

Additional content

None


Thanks

@MartinKolarik
Copy link
Member

Do you have examples of some popular projects that would benefit from this? There are a couple of reasons we didn't do this so far, e.g.:

  • With npm packages, it's clear any dependencies should also be loaded from npm. With GitHub, that's no longer the case (people might be referring to other registries).
  • Most projects using /gh/ are not JS projects; most JS projects publish to npm anyway.

@KaKi87
Copy link
Author

KaKi87 commented Jun 22, 2023

Do you have examples of some popular projects that would benefit from this?

No, because popular projects always publish to NPM. The point of this is precisely to be able to use unpopular projects.

With npm packages, it's clear any dependencies should also be loaded from npm

When a module is run locally, NPM is also the default registry anyway.

Most projects using /gh/ are not JS projects; most JS projects publish to npm anyway.

True. But this feature would still be useful to minorities.

Here's an additional use case of this feature, although minor as well : importing a development version or a forked version of a package (whether popular or not) without needing to publish it.

Thanks

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

2 participants