[Vuejs]-How to use Vue Router's lazy loading with vue-class-component?

-1👍

This is how you can use lazy routing in vuejs

path: "/",
    name: "index",
    component: () =>
        import("../views/Index.vue")

-1👍

just as MaBbKhawaja said,

path: "/",
    name: "index",
    component: () =>
        import("../views/Index.vue")

you can also assign chunkName like this

path: "/",
    name: "index",
    component: () =>
        import(/* webpackChunkName: "Home" */ "../views/Index.vue")

The docs gives a better explanation

Leave a comment