Description
Bug report
- I confirm this is a bug with Supabase, not with my own application.
- I confirm I have searched the Docs, GitHub Discussions, and Discord.
Describe the bug
When building for Nuxt, once deployed applications will fail to run. It appears this gets into the server build.
https://github.com/supabase/realtime-js/blob/master/src/WebSocket.ts#L8
In server.mjs output this looks like this
const {
PostgrestClient,
PostgrestQueryBuilder,
PostgrestFilterBuilder,
PostgrestTransformBuilder,
PostgrestBuilder,
PostgrestError
} = index$2;
let WebSocketImpl;
{
WebSocketImpl = require("ws");
}
const version$3 = "2.11.9";
const DEFAULT_HEADERS$3 = { "X-Client-Info": `realtime-js/${version$3}` };
const VSN = "1.0.0";
...
A clear and concise description of what the bug is.
To Reproduce
Install this dep which will be a part of the install for @nuxtjs/supabase
- in the Nuxt application run pnpm build
and then run the output node .output/server/index.mjs
Expected behavior
The application should not crash because we should be using mjs spec which is import/export instead of require.
Screenshots
System information
Using latest version of pnpm, node etc.
Additional context
Please correct me if I'm wrong but I can't see a workaround right now unless this package becomes compatible with ESM? I'm not sure I'm able to configure an optimization but I'll try.