How do you use ky as a CDN without the UMD build? Is it possible? #318
Answered
by
sholladay
jc-camosun
asked this question in
Q&A
-
I've been using ky as a CDN (there's a good reason) link and now with the UMD build dropped, I can't use it anymore in the browser. Or is there a way? |
Beta Was this translation helpful? Give feedback.
Answered by
sholladay
Jan 16, 2021
Replies: 1 comment
-
You can still load Ky from a CDN in the browser. You just need to use ES modules to do so. There are two ways of doing this:
|
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
sindresorhus
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can still load Ky from a CDN in the browser. You just need to use ES modules to do so.
There are two ways of doing this:
Put your app in a
<script type="module">
tag and thenimport
Ky from the CDN and use it directly. The great thing about this is that it avoids using any global variables.Alternatively, in the HTML before your app, add a separate
<script type="module">
tag thatimport
s Ky and adds it to the global scope so that you don't have to modify your existing app.