Skip to content

Commit

Permalink
Added instructions on how to use the browser ESM.
Browse files Browse the repository at this point in the history
  • Loading branch information
koba-ninkigumi authored and soedirgo committed Feb 13, 2022
1 parent 9f7386c commit fe0c5bb
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,20 @@ Then you can use it from a global `supabase` variable:
</script>
```

### ESM

You can now use type="module" `<script>`s to import supabase-js from CDNs, like:

```html
<script type="module">
import { createClient } from "https://cdn.jsdelivr.net/npm/@supabase/supabase-js/+esm"
const supabase = createClient('https://xyzcompany.supabase.co', 'public-anon-key')
console.log('Supabase Instance: ', supabase)
// ...
</script>
```

### Custom `fetch` implementation

`supabase-js` uses the [`cross-fetch`](https://www.npmjs.com/package/cross-fetch) library to make HTTP requests, but an alternative `fetch` implementation can be provided as an option. This is most useful in environments where `cross-fetch` is not compatible, for instance Cloudflare Workers:
Expand Down

0 comments on commit fe0c5bb

Please sign in to comment.