Skip to content

Commit fe0c5bb

Browse files
koba-ninkigumisoedirgo
authored andcommitted
Added instructions on how to use the browser ESM.
1 parent 9f7386c commit fe0c5bb

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,20 @@ Then you can use it from a global `supabase` variable:
4747
</script>
4848
```
4949

50+
### ESM
51+
52+
You can now use type="module" `<script>`s to import supabase-js from CDNs, like:
53+
54+
```html
55+
<script type="module">
56+
import { createClient } from "https://cdn.jsdelivr.net/npm/@supabase/supabase-js/+esm"
57+
const supabase = createClient('https://xyzcompany.supabase.co', 'public-anon-key')
58+
59+
console.log('Supabase Instance: ', supabase)
60+
// ...
61+
</script>
62+
```
63+
5064
### Custom `fetch` implementation
5165

5266
`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:

0 commit comments

Comments
 (0)