When I run npm run dev
, get next error
I write on Vue 2 webpack-simple, firebase 9.9.0
Tried npm firebase@^9.9.0 but no result
main.js
import Vue from 'vue'
import App from './App.vue'
import vuetify from "./plugins/vuetify";
import {Vuelidate} from "vuelidate";
import {firestorePlugin} from "vuefire";
import firebase from "firebase/app";
Vue.use(Vuelidate)
Vue.use(firestorePlugin)
import {store} from "../store";
import {router} from "./plugins/routes"
const firebaseConfig = {
apiKey: "***",
authDomain: "***",
projectId: "***",
storageBucket: "***",
messagingSenderId: "***",
appId: "***",
measurementId: "***"
};
export const db = firebase.initializeApp(firebaseConfig).firestore()
const {Timestamp, GeoPoint} = firebase.firestore()
export {Timestamp, GeoPoint}
db.settings({timestampsInSnapshots: true})
new Vue({
el: '#app',
vuetify,
router,
store,
render: h => h(App)
})
Error
./node_modules/idb/build/index.js
Module parse failed: Unexpected token (83:4)
You may need an appropriate loader to handle this file type.
| }
| replaceTraps((oldTraps) => ({
| ...oldTraps,
| get: (target, prop, receiver) => getMethod(target, prop) || oldTraps.get(target, prop, receiver),
| has: (target, prop) => !!getMethod(target, prop) || oldTraps.has(target, prop),
@ ./node_modules/@firebase/app/dist/esm/index.esm2017.js 5:0-29
@ ./node_modules/firebase/app/dist/index.esm.js
@ ./src/main.js
@ multi (webpack)-dev-server/client?http://localhost:8080 webpack/hot/dev-server ./src/main.js
2
Answers
I just needed to update vue-cli
Tried a lot of things including downgrading firebase, upgrading vue-cli, installing @vue/cli none of which worked for me.
finally tried
npm rebuild firebase
which just worked.P.S. I am not sure but this error is a generic message of vue when it can’t resolve an object property or method. It is not specific to firebase and you can see it in a lot of other cases.