Is there are way to import a js module hosted on github? #25343
-
Hi there, I got a js module hosted on a repo, I try to import it in my project like so :
But apparently github returns the file as a raw text ( Content-Type: text/plain ), I want it to return text/javascript instead, is this somehow possible ? Because I would love to host my modules on github instead of cdn services. Thanks in advance |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments
-
GitHub doesn’t offer a way to do this right now. Services like unpkg do this for npm packages and there are other services that do this as well but not official GitHub services. |
Beta Was this translation helpful? Give feedback.
-
Any plans on supporting this in the future or is this out of the scope of Github goals ? |
Beta Was this translation helpful? Give feedback.
-
We’re interested in doing this to support Deno and other use cases but the timeline is unclear. |
Beta Was this translation helpful? Give feedback.
-
Using GitHub Pages appears to be a popular workaround, see: How to link files directly from Github (raw.github.com)
github, github-pages, cdn
answered by |
Beta Was this translation helpful? Give feedback.
-
Works perfectly ! Thanks y’all |
Beta Was this translation helpful? Give feedback.
Using GitHub Pages appears to be a popular workaround, see:
stackoverflow.comHow to link files directly from Github (raw.github.com)
answered by
Sista Fiolen
on 07:26AM - 30 May 18 UTC