How do you use ky as a CDN without the UMD build? Is it possible? #318
-
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.
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.
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.