[Vuejs]-Entrypoint size limit: code splitting to limit the size of entrypoints in vue cli 3.x

0👍

Try to load your components asynchronously.

Also prefer local component registration over global.

0👍

We can also split each route’s component into separate chunks and only load them when the route is visited.

In your router.js file:

// replace
// import UserDetails from './views/UserDetails'
// with
const UserDetails = () => import('./views/UserDetails')

const router = createRouter({
  // ...
  routes: [{ path: '/users/:id', component: UserDetails }],
})

For further information read the official documentation.

Leave a comment