Open astamant-nosm opened 1 year ago
Actually, I think I may have solved it.
// main.js
import { createApp, markRaw } from 'vue';
import { createPinia } from 'pinia';
import { router } from './router';
import App from './App.vue';
const app = createApp(App);
const pinia = createPinia();
pinia.use(({ store }) => {
store.$router = markRaw(router);
});
app.use(pinia);
app.use(router);
app.mount('#app');
And then in stores:
this.$router.push(this.returnUrl) // or w/e you need to do
Disclaimer: I'm new to Vite and Vue and could be wrong about this.
After upgrading Vite to the latest version, I started getting the following HMR reload error:
As soon as I remove the router import statement in
auth.store.js
, this error no longer happens and I can use HMR like I used to.Is there a way to access the router without re-importing it? I think that would solve my issue.
Here are my dependencies: