ably-js icon indicating copy to clipboard operation
ably-js copied to clipboard

Provide a ESM bundle

Open jimmywarting opened this issue 3 years ago • 1 comments

I wish to simply import this sdk without the need of using npm... just a cdn, with:

<script type=module>
import alby from 'https://cdn.xyz/alby.js'
</script>

┆Issue is synchronized with this Jira Task by Unito

jimmywarting avatar Nov 09 '21 17:11 jimmywarting

Hi @jimmywarting,

As well as NPM, we currently distribute ably-js through our CDN, (usage instructions are in the README here). The CDN distribution is a UMD module, so you can use it with AMD/requireJS or CommonJS if you want but by default it will just add the Ably library to the window. Here's a working example that you can use to create an ably client using the CDN:

<script src="https://cdn.ably.com/lib/ably.min-1.js"></script>
<script type="module>
  const realtime = new Ably.Realtime({ key: '<YOUR_API_KEY>' });
</script>

Please let us know more about your use case if this doesn't work as a solution for you.

owenpearson avatar Nov 09 '21 17:11 owenpearson

Closing this issue as stale please re-open this issue if you need further support.

deanna-lad avatar Apr 17 '23 14:04 deanna-lad