S
SolidJS•2mo ago
jtag05

ReferenceError: exports is not defined when using islands on dev

First of all, congrats on the v1 launch 🎉 ! I have been playing around over the weekend and hit a snag where I am getting this error log from a node_module exclusively when running islands in development. Using build & start, everything works just fine. I noticed a similar error reported back in 2022 (https://github.com/solidjs/solid-start/issues/221). I'm curious if anyone has figured out the root cause of this yet. Full Error:
[vite] Error when evaluating SSR module /node_modules/.pnpm/@supabase+node-fetch@2.6.15/node_modules/@supabase/node-fetch/lib/index.js:
|- ReferenceError: exports is not defined
[vite] Error when evaluating SSR module /node_modules/.pnpm/@supabase+node-fetch@2.6.15/node_modules/@supabase/node-fetch/lib/index.js:
|- ReferenceError: exports is not defined
1 Reply
jtag05
jtag05•2mo ago
For anyone that hits this in the future. The resolution was to tell vite that this dependency is an external in your app.config.ts
export default defineConfig({
ssr: true,
experimental: {
islands: true,
},
vite: {
ssr: {
external: ["@supabase/ssr"], // Or whatever dependency is throwing this for you.
},
},
});
export default defineConfig({
ssr: true,
experimental: {
islands: true,
},
vite: {
ssr: {
external: ["@supabase/ssr"], // Or whatever dependency is throwing this for you.
},
},
});