This repository was archived by the owner on Nov 6, 2025. It is now read-only.
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' ;
23import { type UUIIconHost , UUIIconRegistry } from '@umbraco-cms/backoffice/external/uui' ;
34
45/**
@@ -59,15 +60,15 @@ export class UmbIconRegistry extends UUIIconRegistry {
5960 return false ;
6061 }
6162
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+ }
6371
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- } ) ;
7172 return true ;
7273 }
7374}
You can’t perform that action at this time.
0 commit comments