firebase.firestore() is not a function when trying to initialize Cloud Firestore

前端 未结 21 1338
独厮守ぢ
独厮守ぢ 2020-12-01 02:45

When I try to initialize Firebase Cloud Firestore, I ran into the following error:

Uncaught TypeError: WEBPACK_IMPORTED_MODULE_0_firebase

相关标签:
21条回答
  • 2020-12-01 03:22

    I found a useful comment in Github by alclimb

    he mentioned about firebase analytics won't work in Node.js, because it meant to be used with a browser (this is mention in the official documentation)

    0 讨论(0)
  • 2020-12-01 03:25

    add this script

    you can read more on the official docs

    https://firebase.google.com/docs/firestore/quickstart#set_up_your_development_environment

    0 讨论(0)
  • 2020-12-01 03:28
    import { firebase } from '@firebase/app';
    import '@firebase/firestore'
    

    If you're using authentication as well

    import '@firebase/auth';
    
    0 讨论(0)
提交回复
热议问题