Skip to content

Commit f84032d

Browse files
committed
Lazy-load HomeView route component
Change the Example route's component to a dynamic import to enable code-splitting and async loading (webpackChunkName: "HomeView"). Also remove the now-unused static import of HomeView to avoid bundling the view in the main chunk and reduce initial bundle size.
1 parent 9d5d8ab commit f84032d

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

template/ui/src/index.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { definePlugin } from '@halo-dev/ui-shared'
2-
import HomeView from './views/HomeView.vue'
32
import { IconPlug } from '@halo-dev/components'
43
import { markRaw } from 'vue'
54

@@ -11,7 +10,7 @@ export default definePlugin({
1110
route: {
1211
path: '/example',
1312
name: 'Example',
14-
component: HomeView,
13+
component: () => import(/* webpackChunkName: "HomeView" */ './views/HomeView.vue'),
1514
meta: {
1615
title: '示例页面',
1716
searchable: true,

0 commit comments

Comments
 (0)