-
ContextI'm in the process of integrating Supabase into my Hono on Cloudflare Pages project and came across issues when running I thought it would integrate nicely since I already created a PoC project using Supabase with Hono, but it seems that I'm using it in a worker, without the Hono Vite plugins for Cloudflare Pages. When I made a new project with the Cloudflare Pages Hono template, integrating Supabase throws errors when bundling the worker. You can check the branch and build it yourself here: Luzefiru/netzwelt-ats. I'm guessing it's because the Supabase modules uses Any help or ideas would be much appreciated. What I've tried:
Error Logsbun run dev Logs9:21:29 PM [vite] Error when evaluating SSR module /node_modules/@supabase/node-fetch/lib/index.js: |- ReferenceError: exports is not defined at eval (C:/Users/LENOVO/my-hono-project/node_modules/@supabase/node-fetch/lib/index.js:5:23) at instantiateModule (file:///C:/Users/LENOVO/my-hono-project/node_modules/vite/dist/node/chunks/dep-G-px366b.js:54758:15)9:21:29 PM [vite] Error when evaluating SSR module /node_modules/@supabase/postgrest-js/dist/module/PostgrestBuilder.js: failed to import "/node_modules/@supabase/node-fetch/lib/index.js" 9:21:29 PM [vite] Error when evaluating SSR module /node_modules/@supabase/postgrest-js/dist/module/PostgrestTransformBuilder.js: failed to 9:21:29 PM [vite] Error when evaluating SSR module /node_modules/@supabase/postgrest-js/dist/module/PostgrestFilterBuilder.js: failed to import "/node_modules/@supabase/postgrest-js/dist/module/PostgrestTransformBuilder.js" 9:21:29 PM [vite] Error when evaluating SSR module /node_modules/@supabase/postgrest-js/dist/module/PostgrestQueryBuilder.js: failed to import "/node_modules/@supabase/postgrest-js/dist/module/PostgrestFilterBuilder.js" 9:21:29 PM [vite] Error when evaluating SSR module /node_modules/@supabase/postgrest-js/dist/module/PostgrestClient.js: failed to import "/node_modules/@supabase/postgrest-js/dist/module/PostgrestQueryBuilder.js" 9:21:29 PM [vite] Error when evaluating SSR module /node_modules/@supabase/postgrest-js/dist/module/index.js: failed to import "/node_modules/@supabase/postgrest-js/dist/module/PostgrestClient.js" 9:21:29 PM [vite] Error when evaluating SSR module /node_modules/@supabase/supabase-js/dist/module/SupabaseClient.js: failed to import "/node_modules/@supabase/postgrest-js/dist/module/index.js" 9:21:29 PM [vite] Error when evaluating SSR module /node_modules/@supabase/supabase-js/dist/module/index.js: failed to import "/node_modules/@supabase/supabase-js/dist/module/SupabaseClient.js" 9:21:29 PM [vite] Error when evaluating SSR module /node_modules/@supabase/ssr/dist/index.mjs: failed to import "/node_modules/@supabase/supabase-js/dist/module/index.js" 9:21:29 PM [vite] Error when evaluating SSR module /app/server/middleware/supabase.tsx: failed to import "/node_modules/@supabase/ssr/dist/index.mjs" 9:21:29 PM [vite] Error when evaluating SSR module app/server/index.tsx: failed to import "/app/server/middleware/supabase.tsx" 9:21:29 PM [vite] Internal server error: exports is not defined bun run deploy Logs$ bun run deploy $ bun run build && wrangler pages deploy dist $ vite build --mode bundle && vite build vite v5.1.5 building for bundle... transforming (25) node_modules\@editorjs\marker\dist\marker.mjs 🌼 daisyUI 4.7.2 ├─ ✔︎ 2 themes added https://daisyui.com/docs/themes ╰─ ★ Star daisyUI on GitHub https://github.com/saadeghi/daisyuinode_modules/htmx.org/dist/htmx.min.js (1:5388) Use of eval in "node_modules/htmx.org/dist/htmx.min.js" is strongly discouraged as it poses security risks and may cause issues with minification. ✨ Success! Uploaded 1 files (9 already uploaded) (3.63 sec) X [ERROR] 14 error(s) and 1 warning(s) when compiling Worker. X [ERROR] Could not resolve "stream"
The package "stream" wasn't found on the file system but is built into node. X [ERROR] Could not resolve "http"
The package "http" wasn't found on the file system but is built into node. X [ERROR] Could not resolve "url"
The package "url" wasn't found on the file system but is built into node. X [ERROR] Could not resolve "https"
The package "https" wasn't found on the file system but is built into node. X [ERROR] Could not resolve "zlib"
The package "zlib" wasn't found on the file system but is built into node. X [ERROR] Could not resolve "stream"
The package "stream" wasn't found on the file system but is built into node. X [ERROR] Could not resolve "zlib"
The package "zlib" wasn't found on the file system but is built into node. X [ERROR] Could not resolve "buffer"
The package "buffer" wasn't found on the file system but is built into node. X [ERROR] Could not resolve "crypto"
The package "crypto" wasn't found on the file system but is built into node. X [ERROR] Could not resolve "https"
The package "https" wasn't found on the file system but is built into node. X [ERROR] Could not resolve "http"
The package "http" wasn't found on the file system but is built into node. X [ERROR] Could not resolve "net"
The package "net" wasn't found on the file system but is built into node. X [ERROR] Could not resolve "tls"
The package "tls" wasn't found on the file system but is built into node. X [ERROR] Could not resolve "url"
The package "url" wasn't found on the file system but is built into node. ▲ [WARNING] Comparison with -0 using the "===" operator will also match 0 [equals-negative-zero]
Floating-point equality is defined such that 0 and -0 are equal, so "x === -0" returns true for both 0 and -0. You need to use "Object.is(x, -0)" instead to test for -0. X [ERROR] Build failed with 14 errors: _worker.js:1:14: ERROR: Could not resolve "stream" 🪵 Logs were written to "C:\Users\LENOVO.wrangler\logs\wrangler-2024-04-02_13-45-45_092.log" |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Hi @Luzefiru ! Maybe you should add some dependencies to export default defineConfig(({ mode }) => {
//...
return {
...globalConfig,
ssr: {
external: ['@supabase/ssr'] // <=== Add this
},
///...
}) |
Beta Was this translation helpful? Give feedback.
Hi @Luzefiru !
Maybe you should add some dependencies to
ssr.external
invite.config.ts
. Try this: