diff --git a/src/assets/img/icons.ts b/src/assets/img/icons.ts index a24f439b..6a9d8a60 100755 --- a/src/assets/img/icons.ts +++ b/src/assets/img/icons.ts @@ -14,8 +14,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -const requireComponent: any = import.meta.glob("./technologies/*.svg"); -const requireTool: any = import.meta.glob("./tools/*.png"); +const requireComponent: any = import.meta.glob("./technologies/*.png", { eager: true }); +const requireTool: any = import.meta.glob("./tools/*.png", { eager: true }); const result: { [key: string]: string } = {}; const t: { [key: string]: string } = {}; @@ -28,19 +28,15 @@ function validateFileName(str: string): string | undefined { } } Object.keys(requireComponent).forEach((filePath: string) => { - const componentConfig = requireComponent(filePath); - const fileName = validateFileName(filePath); if (fileName) { - result[fileName] = componentConfig; + result[fileName] = requireComponent[filePath].default; } }); Object.keys(requireTool).forEach((filePath: string) => { - const componentConfig = requireTool[filePath]; - const fileName = validateFileName(filePath); if (fileName) { - t[fileName] = componentConfig; + t[fileName] = requireTool[filePath].default; } });