natemoo-re / astro-icon

Inline and sprite-based SVGs in Astro made easy!
https://astroicon.dev
Other
1.01k stars 57 forks source link

Cannot load SVG icon although the files is there #50

Closed chayapan closed 1 year ago

chayapan commented 1 year ago

I have an SVG icon that I want to use. I out the SVG file in /src/icons in the project but when rendering it doesn't work.

Here is the error

Error: [astro-icon] Unable to load "/src/icons/mylogo.svg". Does the file exist? at Module.load [as default] (/node_modules/astro-icon/lib/utils.ts:182:13) at eval (/node_modules/astro-icon/lib/Icon.astro:26:52) at Module.renderToIterable (/node_modules/astro/dist/runtime/server/render/astro.js:76:27) at renderAstroComponentInline (/node_modules/astro/dist/runtime/server/render/component.js:75:52) at renderAstroComponentInline.next (<anonymous>) at Module.renderChild (/node_modules/astro/dist/runtime/server/render/any.js:25:5) at processTicksAndRejections (node:internal/process/task_queues:96:5) at async AstroComponent.[Symbol.asyncIterator] (/node_modules/astro/dist/runtime/server/render/astro.js:37:7) at async Module.renderAstroComponent (/node_modules/astro/dist/runtime/server/render/astro.js:45:20) at async renderChild (/node_modules/astro/dist/runtime/server/render/any.js:23:5)

stramel commented 1 year ago

@chayapan Can you provide the code you're using to help us debug?

chayapan commented 1 year ago

This bug is fixed as of 1.0.9. Here is part of the working astro.config.mjs

... export default defineConfig({ site: SITE_URL, base: SITE_PATH, vite: { ssr: { external: ["@11ty/eleventy-img", "svgo"], }, }, });