vuejs / vuefire

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

Broken: "firebase.json" file doesn't exist + import issue #1470

Closed lambda0xff closed 7 months ago

lambda0xff commented 7 months ago

Reproduction

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

Steps to reproduce the bug

  1. create brand new nuxt project: pnpm dlx nuxi@latest init <project-name>
  2. pnpm install vuefire nuxt-vuefire firebase
  3. pnpm install firebase-admin firebase-functions @firebase/app-types
  4. modify nuxt.config.ts:
    
    modules: ['nuxt-vuefire'],
    vuefire: {
        auth: {
          enabled: true
        },
        config: {
            apiKey: "---",
            authDomain: "---",
            projectId: "---",
            storageBucket: "---",
            messagingSenderId: "---",
            appId: "---"
        }
    }

5. create a `.env` file with the following line: `GOOGLE_APPLICATION_CREDENTIALS=./service-account.json`
6. Generate a new private key in the firebase console and move it to root of project with name `service-account.json`
7. `pnpm run dev` generates two errors/warnings:
  a. The "firebase.json" file doesn't exist
  b. [nuxt] `#imports` should be transformed with real imports. There seems to be something wrong with the imports plugin.

### Expected behavior

Should work

### Actual behavior

Doesn't

### Additional information

package.json:
{
  "name": "nuxt-app",
  "private": true,
  "type": "module",
  "scripts": {
    "build": "nuxt build",
    "dev": "nuxt dev",
    "generate": "nuxt generate",
    "preview": "nuxt preview",
    "postinstall": "nuxt prepare"
  },
  "devDependencies": {
    "@nuxt/devtools": "latest",
    "nuxt": "^3.8.2",
    "vue": "^3.3.8",
    "vue-router": "^4.2.5"
  },
  "dependencies": {
    "@firebase/app-types": "^0.9.0",
    "firebase": "^10.7.0",
    "firebase-admin": "^11.11.1",
    "firebase-functions": "^4.5.0",
    "nuxt-vuefire": "^0.4.1",
    "vuefire": "^3.1.18"
  }
}
posva commented 7 months ago

A real repro as asked in the new bug report form would help me check this further regarding the firebase.json warning or error.

As for the second issue, this seems related: https://github.com/vuejs/vuefire/discussions/1460

lambda0xff commented 7 months ago

Fist time trying to use 'vuefire' so maybe I missed something obvious regarding the 'firebase.json' issue: do I need to run 'firebase init' in my project ? That creates the 'firebase.json' file and seems to solve the issue but it is not clear from the docs that this is a required step ?

posva commented 7 months ago

Yes, it's required. I recommend you to give these templates a look: https://vuefire.vuejs.org/nuxt/deployment.html they contain more detailed explanations on how to setup the project. The only thing you might need is to update the dependencies

lambda0xff commented 7 months ago

Thanks for the clarification. 👍

snsxn commented 6 months ago

The warning still exists using latest nuxt-vuefire@1.0.0 [nuxt] #imports should be transformed with real imports. There seems to be something wrong with the imports plugin