@@ -17,11 +17,6 @@ import { createApp } from 'vue'
1717 } ,
1818}
1919
20- import Index from './views/Index.vue'
21- import Edit from './views/Edit.vue'
22- import File from './views/File.vue'
23- import Zip from './views/Zip.vue'
24- import GitHubExporter from './views/Export/GitHub.vue'
2520import AudioRecorder from 'vue3-mic-recorder'
2621import { randomString } from './ts/utils'
2722
@@ -74,32 +69,32 @@ const router = async () => {
7469 }
7570
7671 const routes = [
77- { path : '/' , view : Index } ,
72+ { path : '/' , view : ( ) => import ( './views/ Index.vue' ) } ,
7873 { path : '/edit' , redirect : '?/edit/' + randomString ( 24 ) } ,
79- { path : '/edit/:storageId/:connection' , view : Edit } ,
80- { path : '/edit/:storageId' , view : Edit } ,
74+ { path : '/edit/:storageId/:connection' , view : ( ) => import ( './views/ Edit.vue' ) } ,
75+ { path : '/edit/:storageId' , view : ( ) => import ( './views/ Edit.vue' ) } ,
8176 {
8277 path : '/embed/code/edit/:zipCode' ,
83- view : Zip ,
78+ view : ( ) => import ( './views/ Zip.vue' ) ,
8479 params : { embed : true , mode : - 1 } ,
8580 } ,
8681 {
8782 path : '/embed/code/preview/:zipCode' ,
88- view : Zip ,
83+ view : ( ) => import ( './views/ Zip.vue' ) ,
8984 params : { embed : true , mode : 1 } ,
9085 } ,
91- { path : '/embed/code/:zipCode' , view : Zip , params : { embed : true } } ,
92- { path : '/embed/file/:fileUrl' , view : File , params : { embed : true } } ,
86+ { path : '/embed/code/:zipCode' , view : ( ) => import ( './views/ Zip.vue' ) , params : { embed : true } } ,
87+ { path : '/embed/file/:fileUrl' , view : ( ) => import ( './views/ File.vue' ) , params : { embed : true } } ,
9388
94- { path : '/show/code/:zipCode' , view : Zip } ,
95- { path : '/show/file/:fileUrl' , view : File } ,
89+ { path : '/show/code/:zipCode' , view : ( ) => import ( './views/ Zip.vue' ) } ,
90+ { path : '/show/file/:fileUrl' , view : ( ) => import ( './views/ File.vue' ) } ,
9691 {
9792 path : '/export/github/&code=:code&state=:stepId2' ,
98- view : GitHubExporter ,
93+ view : ( ) => import ( './views/Export/GitHub.vue' ) ,
9994 } ,
10095 {
10196 path : '/export/github/:stepId1' ,
102- view : GitHubExporter ,
97+ view : ( ) => import ( './views/Export/GitHub.vue' ) ,
10398 } ,
10499 ]
105100
@@ -131,11 +126,12 @@ const router = async () => {
131126 }
132127
133128 const params = getParams ( match )
134- const view = match . route . view as any
129+ const loader = match . route . view as ( ) => Promise < { default : any } >
135130
136131 app ?. unmount ( )
137132
138- app = createApp ( view , params )
133+ const ViewModule = await loader ( )
134+ app = createApp ( ViewModule . default , params )
139135 app . use ( AudioRecorder )
140136
141137 app . mount ( document . body )
0 commit comments