natemoo-re / astro-icon

Inline and sprite-based SVGs in Astro made easy!

Home Page:https://astroicon.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Astro V4: Icons can no longer be found

ConduciveMammal opened this issue · comments

After upgrading to Astro V4, I received the following error.

Error: [astro-icon] Unable to load "/src/icons/speaker.wave.svg". Does the file exist?
    at Module.load [as default] (/Users/liammerlyn/Development.nosync/MDWAstro/node_modules/astro-icon/lib/utils.ts:184:13)
    at eval (/Users/liammerlyn/Development.nosync/MDWAstro/node_modules/astro-icon/lib/Icon.astro:22:52)
    at AstroComponentInstance.Icon [as factory] (/Users/liammerlyn/Development.nosync/MDWAstro/frontend/node_modules/astro/dist/runtime/server/astro-component.js:21:12)
    at AstroComponentInstance.init (/Users/liammerlyn/Development.nosync/MDWAstro/frontend/node_modules/astro/dist/runtime/server/render/astro/instance.js:39:29)
    at AstroComponentInstance.render (/Users/liammerlyn/Development.nosync/MDWAstro/frontend/node_modules/astro/dist/runtime/server/render/astro/instance.js:44:18)
    at Object.render (/Users/liammerlyn/Development.nosync/MDWAstro/frontend/node_modules/astro/dist/runtime/server/render/component.js:342:22)
    at Module.renderChild (/Users/liammerlyn/Development.nosync/MDWAstro/frontend/node_modules/astro/dist/runtime/server/render/any.js:36:17)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

Looking at the Migration guide - import.meta.globEager has now been replaced with import.meta.glob('*', { eager: true }).

To test, I opened utils.ts: line 191 and switched the call, meaning the icons successfully loaded again.

This has been fixed in the latest version! Please upgrade to astro-icon@0.8.2 which was released from #154