nuxt-modules / supabase

Supabase module for Nuxt.
https://supabase.nuxtjs.org
MIT License
630 stars 119 forks source link

Update module to work with Nuxt 3.8.0 #298

Closed CptJJ closed 4 days ago

CptJJ commented 8 months ago

Nuxt 3.8 warns about possible broken modules: "You may also encounter modules in the Nuxt ecosystem that need to be updated; please open an issue for those modules. I'm also very happy to help if you're encountering any problems with this, if you're a module author. Just tag me and I'll take a look."

I get this when launching the dev server:

Failed to resolve dependency: @supabase/functions-js, present in 'optimizeDeps.include'                                                   11:43:02 AM
 WARN  Failed to resolve dependency: @supabase/gotrue-js, present in 'optimizeDeps.include'                                                      11:43:02 AM
 WARN  Failed to resolve dependency: @supabase/postgrest-js, present in 'optimizeDeps.include'                                                   11:43:02 AM
 WARN  Failed to resolve dependency: @supabase/realtime-js, present in 'optimizeDeps.include'                                                    11:43:02 AM
 WARN  Failed to resolve dependency: @supabase/storage-js, present in 'optimizeDeps.include'                                                     11:43:02 AM
 WARN  Failed to resolve dependency: @supabase/supabase-js, present in 'optimizeDeps.include'   

and then get the error:

Uncaught SyntaxError: The requested module '/_nuxt/node_modules/.pnpm/@supabase+node-fetch@2.6.14/node_modules/@supabase/node-fetch/browser.js?v=0907fba1' does not provide an export named 'default' (at PostgrestBuilder.ts:2:8)

@danielroe

CptJJ commented 8 months ago

Might have been an issue with pnpm brought up when i upgraded to 3.8? built with bun and it went away... strange...

jeremykung commented 8 months ago

I'm also getting an issue that seems to come from the Supabase Module. I'm using Nuxt 3.8 with Node.js runtime. Cannot find module './lib/websocket' Require stack: - ~\nuxt-app\websocket

richard-edwards commented 8 months ago

I'm having a similar issue with Nuxt 3.8 and also back ported to 3.7 and same error. Did a full package clean and restore.

PostgrestBuilder.ts:2 Uncaught SyntaxError: The requested module '/_nuxt/node_modules/.pnpm/@supabase+node-fetch@2.6.14/node_modules/@supabase/node-fetch/browser.js?v=a82b1307' does not provide an export named 'default' (at PostgrestBuilder.ts:2:8)

I'm getting no errors in the dev server, just the one above in the browser console.

madebyfabian commented 2 months ago

Have the same error when using pnpm, nuxt@^3.11.2 and @nuxtjs/supabase@^1.2.0. Setting shamefully-hoist=true in .npmrc solves this though.

ollu commented 2 months ago

Thanks @madebyfabian, this solved my problem with

WARN Failed to resolve dependency: @supabase/gotrue-js, present in 'optimizeDeps.include'

What I did:

  1. Created an .npmrc-file in the root of my project
  2. Added shamefully-hoist=true to it
  3. Saved the file and ran npm run dev again Voilá, no more warning!

The content of my .npmrc-file:

# https://pnpm.io/npmrc#shamefully-hoist
# Fixes: WARN Failed to resolve dependency: @supabase/gotrue-js, present in 'optimizeDeps.include'
shamefully-hoist=true

Not clear to me why this worked with npm since it seems to me to be an pnpm-setting 🤷 Read more about the setting here https://pnpm.io/npmrc#shamefully-hoist

mubaidr commented 2 months ago

I have same npm config, but this warning still exists in latest nuxt version.

------------------------------
- Operating System: Linux
- Node Version:     v20.11.1
- Nuxt Version:     3.11.2
- CLI Version:      3.11.1
- Nitro Version:    2.9.6
- Package Manager:  pnpm@9.0.6
- Builder:          -
- User Config:      colorMode, css, devtools, experimental, extends, eslint, fonts, hooks, i18n, image, imports, modules, nitro, pinia, router, routeRules, runtimeConfig, security, seo, ssr, studio, supabase, telemetry, typescript, ui, features
- Runtime Modules:  @nuxt/content@2.12.1, @nuxt/eslint@0.3.10, @nuxt/fonts@0.6.1, @nuxt/image@1.6.0, @nuxt/ui@2.15.2, @nuxthq/studio@1.0.13, @nuxtjs/seo@2.0.0-rc.10, @nuxtjs/supabase@1.2.1,@pinia/nuxt@0.5.1, @unlok-co/nuxt-stripe@3.0.0, @vueuse/nuxt@10.9.0, nuxt-og-image@2.2.4, nuxt-security@1.4.3, @nuxtjs/i18n@8.3.1
- Build Modules:    -
------------------------------
bash
WARN  Failed to resolve dependency: @supabase/gotrue-js, present in 'optimizeDeps.include'
maxiosigma commented 3 weeks ago

vite: { ...oldCode, optimizeDeps: { include: ['@supabase/gotrue-js'] }, }

danielroe commented 3 weeks ago

You might need to do something like @nuxtjs/supabase > @supabase/gotrue-js if this is a dependency of the module. Vite requires anything in optimizeDeps.include to be accessible within top-level node_modules which will be only true for pnpm users if they have installed it separately.

mubaidr commented 3 weeks ago

Just to clarify, I am using pnpm, but installing @supabase/gotrue-js does not solve this issue.

larbish commented 4 days ago

Might be fixed by the last release.