@@ -82,28 +82,27 @@ export function getIcon(icon: string) {
8282 return resolveComponent ( compName ) ;
8383}
8484
85- export const loadFile = async ( file : string ) => {
85+ export const loadFile = ( file : string ) => {
8686 if ( file . startsWith ( 'http' ) ) {
8787 return file ;
8888 }
89+ console . log ( 'file' , file ) ;
8990 let path ;
9091 let baseUrl = '' ;
91- const files = import . meta. glob ( '/**/*' , { import : 'default' } ) ;
92-
9392 if ( file . startsWith ( '@/' ) ) {
94- path = file . replace ( '@/' , '/src/' ) ;
93+ path = file . replace ( '@/' , '' ) ;
94+ console . log ( 'path' , path ) ;
95+ const fileModulePath = `./${ path } ` ;
96+ console . log ( 'imort.meta.url' , import . meta. url ) ;
97+ baseUrl = new URL ( `./${ path } ` , import . meta. url ) . href ;
98+ console . log ( 'baseUrl' , baseUrl ) ;
9599 } else if ( file . startsWith ( '@@/' ) ) {
96- path = file . replace ( '@@/' , '/src/custom/' ) ;
97- } else {
98- path = `./${ file } ` ;
99- }
100-
101- const match = files [ path ] ;
102- if ( ! match ) {
103- console . error ( `File ${ file } not found` ) ;
100+ path = file . replace ( '@@/' , '' ) ;
101+ const fileModulePath = `./${ path } ` ;
102+ baseUrl = new URL ( `./${ path } ` , new URL ( import . meta. url ) . origin + new URL ( import . meta. url ) . pathname ) . href ;
104103 } else {
105- const result = await match ( ) ;
106- baseUrl = typeof result === 'string' ? result : '' ;
104+ const fileModulePath = `./ ${ file } ` ;
105+ baseUrl = new URL ( `./ ${ file } ` , new URL ( import . meta . url ) . origin + new URL ( import . meta . url ) . pathname ) . href ;
107106 }
108107 return baseUrl ;
109108}
0 commit comments