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

前端 未结 21 1552
独厮守ぢ
独厮守ぢ 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:01

    If by any chance, your code is under witchcraft, and import firebase/firestore won't work, then include it directly:

    import '@firebase/firestore/dist/esm/index';
    

    If it's not there, then:

    npm install @firebase/firestore
    

提交回复
热议问题