supabase / postgrest-js

Isomorphic JavaScript client for PostgREST.

Home Page:https://supabase.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

The requested module './../../../node-fetch/lib/index.js' does not provide an export named 'default' (at PostgrestBuilder.js:1:8)

kjhughes opened this issue · 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

Adding a component that uses Supabase to Shoelace components produces the following error:

SyntaxError: The requested module './../../../node-fetch/lib/index.js' does not provide an export named 'default' (at PostgrestBuilder.js:1:8)

Which references this line in PostgrestBuild.js:

// @ts-ignore
import nodeFetch from '@supabase/node-fetch';

To Reproduce

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

  1. git clone https://github.com/shoelace-style/shoelace
  2. cd shoelace
  3. npm install @supabase/supabase-js
  4. npm install
  5. npm run build
  6. npm run test => All tests pass, check.
  7. Add Supabase to one of the components such as src/components/alert/alert.component.ts by adding the following two lines after the existing import statements:
import { createClient } from '@supabase/supabase-js'
createClient('https://xyzcompany.supabase.co', 'public-anon-key')
  1. npm run test
  2. Observe that now all tests fail to even load, each giving an error of the following form:
src/components/alert/alert.test.ts:

 🚧 Browser logs on Chromium:
      SyntaxError: The requested module './../../../node-fetch/lib/index.js' does not provide an export named 'default'
 🚧 Browser logs on Webkit:
      SyntaxError: Importing binding name 'default' cannot be resolved by star export entries.

 ❌ Could not import your test module. Check the browser logs or open the browser in debug mode for more information. 

Expected behavior

Adding Supabase to a component should not cause its test and the tests of all other components in the package to fail to load.

System information

  • OS: macOS Sonoma 14.2.1
  • Browsers tested: chrome, safari
  • Version of supabase-js: 2.1.5
  • Version of Node.js: 21.5.0

Related report

This open issue appears to be related, but since it did not include a detailed means to reproduce, I thought I'd create a new issue to facilitate reproduction in hopes to resolve this more quickly:

I've closed this issue and posted instead to supabase/supabase#21261 because is more pervasive as it prevents any Supabase functions from working as supabase-js cannot even load.