File tree Expand file tree Collapse file tree 1 file changed +10
-9
lines changed
src/packages/core/icon-registry Expand file tree Collapse file tree 1 file changed +10
-9
lines changed Original file line number Diff line number Diff line change 1
- import type { UmbIconDefinition } from './types.js' ;
1
+ import type { UmbIconDefinition , UmbIconModule } from './types.js' ;
2
+ import { loadManifestPlainJs } from '@umbraco-cms/backoffice/extension-api' ;
2
3
import { type UUIIconHost , UUIIconRegistry } from '@umbraco-cms/backoffice/external/uui' ;
3
4
4
5
/**
@@ -59,15 +60,15 @@ export class UmbIconRegistry extends UUIIconRegistry {
59
60
return false ;
60
61
}
61
62
62
- const iconPath = iconManifest . path ;
63
+ try {
64
+ const iconModule = await loadManifestPlainJs < UmbIconModule > ( iconManifest . path ) ;
65
+ if ( ! iconModule ) throw new Error ( `Failed to load icon ${ iconName } ` ) ;
66
+ if ( ! iconModule . default ) throw new Error ( `Icon ${ iconName } is missing a default export` ) ;
67
+ iconProvider . svg = iconModule . default ;
68
+ } catch ( error : any ) {
69
+ console . error ( `Failed to load icon ${ iconName } ` , error . message ) ;
70
+ }
63
71
64
- import ( /* @vite -ignore */ iconPath )
65
- . then ( ( iconModule ) => {
66
- iconProvider . svg = iconModule . default ;
67
- } )
68
- . catch ( ( err ) => {
69
- console . error ( `Failed to load icon ${ iconName } on path ${ iconPath } ` , err . message ) ;
70
- } ) ;
71
72
return true ;
72
73
}
73
74
}
You can’t perform that action at this time.
0 commit comments