Closed ixxie closed 3 years ago
I've now tried a similar minimal example using es5-ext/global
directly and it seems the root of the issue is there. It seems this package is abandoned (not github activity for a year) and perhaps an alternative should be suggested to the websocket
maintainers but I am not sure what it would be...
Perhaps https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis could be used if it's available
@benmccann this is what I suggested and this was already released into websockets@1.0.34
by its maintainer (see https://github.com/theturtle32/WebSocket-Node/issues/415).
We originally used globalThis in gotrue and had to polyfill it: https://github.com/supabase/gotrue-js/issues/38
I find this a bit odd though, because our supabase-js client is isomorphic. We already use it in a node environment and it works fine 🤔
Anyway, this issue seems fixed by websocket@1.0.34, so at most we'd need to upgrade package.json
and then can close this
I'm not sure if it's related to the globalThis
issue, but once the globalThis
issue is fixed I encounter another issue that seems to be a Vite bug: https://github.com/vitejs/vite/issues/2995
OK I bumped to the latest. I'll leave this open if anyone can confirm the fix?
:tada: This issue has been resolved in version 1.11.3 :tada:
The release is available on:
Your semantic-release bot :package::rocket:
Thanks! There's multiple issues left running Supabase with SvelteKit, but they're pretty clearly issues with Vite so we'll work on those in that repo. Thanks for all your help!
Bug report
Describe the bug
When importing
createClient
into a SvelteKit project, the following error is raised:It seems to come from this block of code in the Websockets package.
To Reproduce
Expected behavior
Import should work without error
Screenshots
If applicable, add screenshots to help explain your problem.
System information
Additional context
This was discovered after resolving https://github.com/supabase/supabase-js/issues/153, after which @kiwicopple recommended I create a new issue.