vuejs / vuefire

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

Nuxt Module is not compatible with `compatibilityVersion: 4` #1544

Open ralacerda opened 2 weeks ago

ralacerda commented 2 weeks ago

Reproduction

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

Steps to reproduce the bug

Install the Nuxt Module in a new project using Nuxt 3.12, and set the future.compatibilityVersion to 4.

Expected behavior

The plugin should work normally

Actual behavior

The following issue is shown on the terminal:

[1:12:59 PM]  WARN  Failed to parse static properties from plugin .nuxt/vuefire-plugin.mjs. Transform failed with 1 error:
<stdin>:12:3: ERROR: Unexpected "%"

  <stdin>:12:3: ERROR: Unexpected "%"
  at failureErrorWithLog (node_modules/esbuild/lib/main.js:1462:15)
  at eval (node_modules/esbuild/lib/main.js:745:50)
  at responseCallbacks.<computed> (node_modules/esbuild/lib/main.js:612:9)
  at handleIncomingPacket (node_modules/esbuild/lib/main.js:667:12)
  at Socket.readFromStdout (node_modules/esbuild/lib/main.js:590:7)
  at Socket.emit (node:events:30:10899)
  at addChunk (node:internal/streams/readable:225:3685)
  at readableAddChunk (node:internal/streams/readable:225:3393)
  at Readable.push (node:internal/streams/readable:225:4971)
  at _0x47a056.onStreamRead (node:internal/stream_base_commons:211:2596)

Additional information

I guess this is a heads up that the module is not yet compatible with Nuxt 4. I would debug it further, but I'm not sure how. Let me know if there is a way I can help with the issue

posva commented 2 weeks ago

I think it’s because of the template. They change but I don’t remember how. Feel free to look further and even submit a PR!

ralacerda commented 2 weeks ago

Looks like this is related to nuxt removing compileTemplate.

Daniel Roe already made an PR to fix it: https://github.com/vuejs/vuefire/pull/1525, which I tested locally and I can confirm it works now.

I got an 500 error about @posva/lru-cache which I fixed by explicitly installing it, which I believe came from pnpm not installing the package when installing nuxt-vuefire locally.