vuejs / vuefire

🔥 Firebase bindings for Vue.js
https://vuefire.vuejs.org
MIT License
3.82k stars 323 forks source link

LRUCache is not a constructor #1390

Closed noook closed 10 months ago

noook commented 11 months ago

Reproduction

https://stackblitz.com/edit/nuxt-starter-gch51w?file=nuxt.config.ts

Steps to reproduce the bug

Expected behavior

The __vite_ssr_import_1__.LRUCache is not a constructor error should not appear

Actual behavior

Impossible to load any page with SSR enabled

Additional information

Node version: v18.14.2 NPM version: 9.5.0

tux2nicolae commented 11 months ago

I noticed the same issue just now, after upgrading to latest version

posva commented 11 months ago

I think there is a bug report in Nuxt about this. It should work if you either install lru-cache yourself or use shamefully hoist option in npmrc

noook commented 11 months ago

Indeed ! Linking it here just in case: https://github.com/nuxt/nuxt/issues/22077

luc122c commented 11 months ago

I've got this issue too.

Linking it here just in case: nuxt/nuxt#22077

Thanks for linking this. I was trying to work out where the issue was coming from.

dosstx commented 11 months ago

I think there is a bug report in Nuxt about this. It should work if you either install lru-cache yourself or use shamefully hoist option in npmrc

adding shamefully-hoist=true to .npmrc does not fix the issue. How exactly do I "install lru-cache yourself" ? Or, did anyone get nuxt-vuefire installed on latest Nuxt version 3.6.5 and it is working?

posva commented 11 months ago

It does fix it with pnpm. You install it yourself with pnpm install lru-cache. I have a sample app at https://github.com/posva/vuefire-nuxt-example where I keep testing things. It has everything working from app cache to auth with SSR. I plan on releasing templates very soon

dosstx commented 11 months ago

It does fix it with pnpm. You install it yourself with pnpm install lru-cache. I have a sample app at https://github.com/posva/vuefire-nuxt-example where I keep testing things. It has everything working from app cache to auth with SSR. I plan on releasing templates very soon

Very good! That fixed it for me.

I look forward to your templates. It has been a long road for me in getting Firebase + nuxt to play nicely when it comes to SSR and auth.

Stf-F commented 11 months ago

It does fix it with pnpm. You install it yourself with pnpm install lru-cache. I have a sample app at https://github.com/posva/vuefire-nuxt-example where I keep testing things. It has everything working from app cache to auth with SSR. I plan on releasing templates very soon

Thanks, did the trick.

juane1000 commented 10 months ago

Started working on a project recently with Nuxt as the feature set is incredible. Using this library to work with firebase has been incredibly painful. I did get around this issue by installing the latest version of that dep manually but that only worked if I had already run the dev server once before to create the build output cache so that it could run again the next time. I realized this was a mistake once I went to deploy it into firebase because it would install everything from scratch in the cloud functions environment.

I will go with the suggested workaround for now and report back but I hope this can get resolved on the Nuxt end. Kind of a show stopper problem that's got me reconsidering the framework of choice unfortunately.

Has anyone been able to get the raw firebase sdk working with the firebase emulators while using the dev server? Seems like anytime a code change happens, and the firebase init code is configured for the emulators, there's a runtime error for attempting to reconfigure the firebase app. Seems like there's no clear/easy way to run startup code that's isolated from the rest of the app for development.