Search code examples
vue.jsnuxt.jspiniaappwrite

__vite_ssr_import_1__.Client is not a constructor Error


I am developing a simple app to showcase CRUD operations with Appwrite and Nuxt 3 (Release Candidate 11). The source code to the same can be found here.

I am using the landing page of the app (index.vue) for simple redirection i.e. if the account exits in the accountStore, I want to redirect the user to /workouts route, else ask them to login by redirection to the /login route.

The problem I am facing is when I am landing on the index.vue page (with no user session in progress in Appwrite), I am still getting redirected to /workouts route, instead of the /login route. I presume the reason for the same is the following error that is being logged in the console. Error

I need help in figuring out from where is the error message originating and how to possibly remedy it.

Here is my public github repo: https://github.com/EshaanAgg/workout-buddy


Solution

  • Maybe this is a bug with Nuxt 3 or Vite since Nuxt 3 is currently only a release candidate.

    Also, in my opinion, Server Side Rendering (SSR) always complicates things so much. It doesn't look like you're using SSR, so you could possibly update your nuxt.config.ts to disable SSR:

    {
       // ... other stuff
       ssr: false
    }