question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Firebase/firestore issue

See original GitHub issue

⚠️ IMPORTANT ⚠️ Please check the following list before proceeding. If you ignore this issue template, your issue will be directly closed.

  • Read the docs.
  • Use Vite >=2.0. (1.x is no longer supported)
  • If the issue is related to 1.x -> 2.0 upgrade, read the Migration Guide first.

Describe the bug

When trying to use Firebase 8.2.3 I get this error:

[plugin:vite:import-analysis] Deep import "firebase/app" should be avoided because dependency "firebase" has been pre-optimized. Prefer importing directly from the module entry:

import { ... } from "firebase"

If the used import is not exported from the package's main entry and can only be attained via deep import, you can explicitly add the deep import path to "optimizeDeps.include" in vite.config.js.

I searched the issues and found related issues to firebase auth, but I’m not including firebase auth, only firestore.

Reproduction

Just add this anywhere:

import Firebase from 'firebase/app'
import 'firebase/firestore'

System Info

  • vite version: ^2.0.0-beta.29
  • Operating System: macOS Big Sur
  • Node version: 15.5
  • Package manager (npm/yarn/pnpm) and version: npm

Question

When the error says add the deep import path to "optimizeDeps.include" in vite.config.js. how can I know what the “deep import path” is?

Thanks a lot!!

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

4reactions
mesqueebcommented, Jan 17, 2021

it worked when I did this in vite.config.ts

import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'

export default defineConfig({
  optimizeDeps: { include: ['firebase/app', 'firebase/firestore'] },
  plugins: [vue()]
})
2reactions
yyx990803commented, Jan 30, 2021

It’s no longer needed in most cases.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cloud Firestore - Firebase
Use our flexible, scalable NoSQL cloud database to store and sync data for client- and server-side development.
Read more >
Issues · firebase/firebase-js-sdk - GitHub
@firebase/rules-unit-testing + vitest throws "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore" ...
Read more >
Flutter - Firebase Firestore operation is not working
I am having a problem. First of all my code: FirebaseAuth _auth = FirebaseAuth.instance; FirebaseFirestore _firestore ...
Read more >
@firebase/firestore - npm
The Cloud Firestore component of the Firebase JS SDK.. Latest version: 3.8.0, last published: 17 days ago. Start using @firebase/firestore ...
Read more >
cloud_firestore | Flutter Package - Pub.dev
Please file FlutterFire specific issues, bugs, or feature requests in our issue ... Plugin issues that are not specific to FlutterFire can be...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found