1👍
✅
You didn’t post your main.js
, but typically, in a Vue app, the router is injected into the Vue app using Vue.use(router)
or something similar. Because of this, the $router
variable is injected into all Vue components and you can access the variable using the this.$router
syntax.
Your firebase.js
file is not a Vue component and therefore there was no $router
injected into it. You’ll need to access your router object by importing it directly from where it is defined instead.
Source:stackexchange.com