使用 vue cli,您可以使用 web-pack 将 vue 路由块捆绑在一起
const routes: Array<RouteRecordRaw> = [
{ path: '/', name: 'Home', component: Home },
{
path: '/login',
name: 'Login',
meta: { alreadyAuth: true },
component: () => import(/* webpackChunkName: "login" */ '../views/public/Login.vue')
},
{ path: '/splash', name: 'Splah', component: Splash },
{
path: '/portal',
name: 'Portal',
meta: { requireAuth: true },
component: () => import(/* webpackChunkName: "portal" */ '../layouts/Dashboard.vue'),
children: [
{ path: '', component: () => import(/* webpackChunkName: "portal" */ '../views/portal/Portal.vue') }
]
}
]
我目前正在使用 Vite 进行项目。有没有办法将块(例如仪表板和门户)捆绑在一起?
运行 nom run build 将为 Portal.js 和 Dashboard.js 生成单独的块文件
谢谢