Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Supabase works with Vite but not SvelteKit dev mode #673

Closed
nathanlindsay opened this issue Mar 25, 2021 · 5 comments
Closed

Supabase works with Vite but not SvelteKit dev mode #673

nathanlindsay opened this issue Mar 25, 2021 · 5 comments

Comments

@nathanlindsay
Copy link

Describe the bug

Importing Supabases's client and refreshing the page shows an error that always looks something like...

500
ENOENT: no such file or directory, open '[project_folder]/node_modules/@supabase/supabase-js/src/index.ts'

Error: ENOENT: no such file or directory, open '[project_folder]/node_modules/@supabase/supabase-js/src/index.ts'

Building and running (npm run build npm run start) works fine, and the client can be used.

Have tested with a normal Vite Svelte app (npm init @vitejs/app) and that works fine.

To Reproduce

npm init svelte@next
npm install
npm install --save @supabase/supabase-js
// index.svelte
import { createClient } from '@supabase/supabase-js'

Reproducible repo

Information about your SvelteKit Installation:

npx: installed 1 in 1.117s

  System:
    OS: macOS 11.2.3
    CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
    Memory: 939.37 MB / 16.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 14.15.4 - /usr/local/bin/node
    Yarn: 1.22.10 - /usr/local/bin/yarn
    npm: 6.14.10 - /usr/local/bin/npm
  Browsers:
    Chrome: 89.0.4389.90
    Safari: 14.0.3
  npmPackages:
    @sveltejs/kit: next => 1.0.0-next.59 
    svelte: ^3.29.0 => 3.35.0

Chrome

static

Severity

I'm probably doing something stupid here, so sorry if this is a waste of your time. But we want to build a simple-ish web app using SvelteKit and Supabase and this is stopping us.

@benmccann benmccann added support and removed support labels Mar 25, 2021
@benmccann benmccann changed the title Supabase doesn't work when running dev Supabase works with Vite but not SvelteKit dev mode Mar 25, 2021
@extraordinaire
Copy link

This happens when the source map for supabase-js is loaded, not sure how to fix it, but it's from here

node_modules/@supabase/supabase-js/dist/module/index.js.map

@benmccann
Copy link
Member

Does it work if you install it as a devDependency? supabase/supabase-js#89 (comment)

@nathanlindsay
Copy link
Author

I've just tested and yes it does work...

Though I'm so certain that I tried this before when trying to figure out the problem and it didn't... Maybe Supabase or SvelteKit was updated between my messing about and creating this issue. Either that or I'm losing my mind. Or both.

Thanks for looking into this!

@benmccann
Copy link
Member

benmccann commented Apr 14, 2021

I think the devDependency trick will only work with adapter-node and adapter-static

If you're using another adapter you will need the Supabase source map issue to be fixed supabase/supabase-js#153

@ixxie
Copy link

ixxie commented Apr 14, 2021

supabase/supabase-js#153 was resolved but now there is also supabase/supabase-js#155

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants