In Vue.js (2.X) I can make a component load asynchronously - which means the code for that component will be stored in a separate bundle - by changing the corresponding route's definition from
// routes.js
import Messages from '@/views/messages'
export default [
{
path: '/messages',
name: 'messages',
component: Messages
}
]
to
// routes.js
export default [
{
path: '/messages',
name: 'messages',
component: () => import('@/views/messages')
}
]
Is there a way that I can bundle 2 (or more) route components together, such that the code for them is stored in the same bundle and loaded (asynchronously) simultaneously?
The reason I want to do this is because the components in this group are only accessible to a user with a certain role, so either all of them are accessible to a user, or none of them are.