filestack / filestack-js

Official Javascript SDK for the Filestack API and content ingestion system.
https://www.filestack.com
MIT License
206 stars 79 forks source link

ES module build (for browsers) #362

Closed wiesson closed 4 years ago

wiesson commented 4 years ago

I'd like to use tools such as https://github.com/vitejs/vite or https://github.com/pikapkg/snowpack but they do require esm versions of the library.

Are there any plans to provide a es module version of filestack-js for browsers? 🤗

I'd like to achieve sth like this:

<script type="module">
  import filestack from 'https://unpkg.com/filestack-js@3.15.0/build/browser/filestack.min.js'
  ...
</script>

// Edit

It looks like, I did it wrong. I have discovered, that an esm build is already provided (quite chonky with ~240kb, but still fine). This looks promising:

<script type="module">
  import * as filestack from 'https://unpkg.com/filestackjs@3.15.0/build/browser/filestack.esm.js';
  const client = filestack.init("my-cool-key", clientOptions);
</script>