#useNavigate: Error (Trying to load server deps on the client ?)

10 messages · Page 1 of 1 (latest)

golden brook
#

Hi,
I made a pause from my Qwik project for some time. I was mostly doing SolidJS during the past year. Qwik has nicely evolved !

So today I decided to to restart my project from the start to have everything up to date. And so far it's been alright. The last issue I have is rather odd:

const nav = useNavigate();

....

<div
  onClick$={async () =>
    await nav(`/code`, {})
  }
  class="btn btn-square btn-success rounded-l-none p-3"
>
  <LuPlay class="h-full w-full" />
</div>

I have this useNavigate to go to the /code page whenever I press the Play button. It worked fine a year ago (lol). But now I get an error when it is trying to navigate to /code:

The requested module 'http://...../node_modules/@supabase/postgrest-js/dist/cjs/index.js?v=24a53f20' doesn't provide an export named: 'default'

My guess is that some client side code is trying to import part of the supabase library but it is not 'exported' by the vite server. I have no idea why it tries to do that, as navigating to that page manually works fine.

#

Note: It does that for every useNavigate

neat salmon
#

question!

#

could be using a Link component right?

neat salmon
#

like auth

#

some library have issue and you have to add them in the viteconfig

#
  return {
    plugins: [qwikCity(), qwikVite(), tsconfigPaths()],
    // This tells Vite which dependencies to pre-build in dev mode.
    optimizeDeps: {
      include: ["@auth/qwik"],
    },```
#

replace the @auth/qwik by your lib