supabase/supabase-js

Uncaught ReferenceError: require is not defined

Closed this issue · 1 comments

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 running the extension in Chrome, the following error appears in the DevTools console:

Uncaught ReferenceError: require is not defined

Stack Trace

Image

Custom setup

I am not using the default Supabase client.
Instead, I created a custom Supabase Manager that persists session data using chrome.storage (instead of localStorage / default storage).
This is necessary for Chrome Extensions (Manifest V3) where background scripts and popups cannot rely on window.localStorage.

Image

To Reproduce

Steps to reproduce the behavior, please provide code snippets or a repository:

  1. Build the extension using Vite
  2. Load the dist/ folder in Chrome via chrome://extensions (Developer Mode → Load unpacked)
  3. Open the extension background page or popup in DevTools
  4. See error require is not defined

Expected behavior

The extension should run in the browser context without requiring Node.js built-ins.

Resolved