Laravel, VueJs, Vite - Can't access 'X' before initialization

Viewed 42

Can someone point me in the right direction,

I have a Laravel application that is using VueJs and Vite to compile assets.

On initial serve i.e

npm run dev

My application works as expected, however, when I make a change to a component I get the following error.

client.ts:113 ReferenceError: Cannot access 'Login' before initialization
    at authRoutes.js?t=1663835744201:10:20

Here's my authRoutes file.

import Login from "@/views/auth/login.vue";
import ForgotPassword from "@/views/auth/forgot-password.vue";
import ResetPassword from "@/views/auth/reset-password.vue";

export default [
    {
        path: "/login",
        name: "Login",
        component: Login,
        meta: { layout: "blank" },
    },
    ...
]

This happens with any route after a change to a component as all my components are loaded in the route file like above.

My app.js

import "./bootstrap";

import { createApp } from "vue";
import App from "./app.vue";
import router from "./router/index";

const app = createApp(App);
app.use(router);
app.mount("#app");
0 Answers
Related