add baseurl in front of dynamic imports for icons

This commit is contained in:
Jacob Overgaard
2022-11-24 15:01:07 +01:00
parent 971a947492
commit 9fd78f6f04

View File

@@ -1,4 +1,5 @@
import { UUIIconRegistry } from '@umbraco-ui/uui';
import { baseUrl } from '@umbraco-cms/utils';
import icons from '../../../../public-assets/icons/icons.json';
interface UmbIconDescriptor {
@@ -13,6 +14,15 @@ interface UmbIconDescriptor {
* @description - Icon Store. Provides icons from the icon manifest. Icons are loaded on demand. All icons are prefixed with 'umb:'
*/
export class UmbIconStore extends UUIIconRegistry {
#baseValue: string;
constructor() {
super();
this.#baseValue = baseUrl();
}
/**
* @param {string} iconName
* @return {*} {boolean}
@@ -24,7 +34,7 @@ export class UmbIconStore extends UUIIconRegistry {
const icon = this.provideIcon(iconName);
import(/* @vite-ignore */ `${iconManifest.path}`).then((iconModule) => {
import(`${this.#baseValue}${iconManifest.path}`).then((iconModule) => {
icon.svg = iconModule.default;
});