It is is done with Webpack.
It can be done for the routes or within components having sub-components.
For a route, it looks like this:
{
path: '/a-route',
name: 'a-route',
component: () =>
import(/* webpackChunkName: "a-route" */ '../views/PageSomething.vue'),
},
Webpack will generate a a-route.js
file that is loaded only when the route is browsed to.
For a component, we use the same techique the parent component: