Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to load local Icons when using "--experimental-static-build" flag #21

Closed
AndreBClark opened this issue Jan 21, 2022 · 3 comments
Closed

Comments

@AndreBClark
Copy link

AndreBClark commented Jan 21, 2022

thanks for making this very useful component.
unfortunately I noticed an issue with using the package with the new experimental build flag. this may be an issue with the new build process, or something wrong with the astro-icon.
of course user error on my end is always a possibility.
let me know if there is any additional information I can provide

  • works fine without the flag, works correctly with astro dev
  • crashes build when running astro build cmd with the experimental build flag.
  • "svgo" is added to vite.ssr.external[]
  • when i click the link in the error to navigate to /src/icons/Wordmark.svg navigates to the correct SVG even though it claims to not be able to load it.
  • build completes, but servering the home page returns a 404
  • are there any specific ways i should format the svg? specific tags/layout within the svg?
  • this is the only obstacle preventing me from using the new build mode, so I will continue using the default astro build process until this is resolved.
  • just tried removing all other props height, class etc.. and error still occurs
---
import { Icon } from 'astro-icon' 
---
 <Icon name="Wordmark" height="42" class="mt-8" />

system config

Error

01:21 AM [build] Error rendering: Error: [astro-icon] Unable to load icon "Wordmark"!
Error: [astro-icon] Unable to load "/src/icons/Wordmark.svg". Does the file exist?
    at file:///home/andreclark/Documents/GitHub/lunarium/frontend/dist/assets/Default.de3d07fa.mjs:42344:13
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async renderToString (file:///home/andreclark/Documents/GitHub/lunarium/frontend/dist/assets/Default.de3d07fa.mjs:1688:21)
    at async renderComponent (file:///home/andreclark/Documents/GitHub/lunarium/frontend/dist/assets/Default.de3d07fa.mjs:1518:20)
    at async _render (file:///home/andreclark/Documents/GitHub/lunarium/frontend/dist/assets/Default.de3d07fa.mjs:1443:11)
    at async renderAstroComponent (file:///home/andreclark/Documents/GitHub/lunarium/frontend/dist/assets/Default.de3d07fa.mjs:1694:20)
    at async _render (file:///home/andreclark/Documents/GitHub/lunarium/frontend/dist/assets/Default.de3d07fa.mjs:1453:12)
    at async renderComponent (file:///home/andreclark/Documents/GitHub/lunarium/frontend/dist/assets/Default.de3d07fa.mjs:1513:20)
    at async _render (file:///home/andreclark/Documents/GitHub/lunarium/frontend/dist/assets/Default.de3d07fa.mjs:1443:11)
    at async renderAstroComponent (file:///home/andreclark/Documents/GitHub/lunarium/frontend/dist/assets/Default.de3d07fa.mjs:1694:20)
01:21 AM [build] Error rendering: Error: [astro-icon] Unable to load icon "Logo"!
Error: [astro-icon] Unable to load "/src/icons/Logo.svg". Does the file exist?
    at file:///home/andreclark/Documents/GitHub/lunarium/frontend/dist/assets/Default.de3d07fa.mjs:42344:13
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async renderToString (file:///home/andreclark/Documents/GitHub/lunarium/frontend/dist/assets/Default.de3d07fa.mjs:1688:21)
    at async renderComponent (file:///home/andreclark/Documents/GitHub/lunarium/frontend/dist/assets/Default.de3d07fa.mjs:1518:20)
    at async _render (file:///home/andreclark/Documents/GitHub/lunarium/frontend/dist/assets/Default.de3d07fa.mjs:1443:11)
    at async renderAstroComponent (file:///home/andreclark/Documents/GitHub/lunarium/frontend/dist/assets/Default.de3d07fa.mjs:1694:20)
    at async renderToString (file:///home/andreclark/Documents/GitHub/lunarium/frontend/dist/assets/Default.de3d07fa.mjs:1689:18)
    at async renderComponent (file:///home/andreclark/Documents/GitHub/lunarium/frontend/dist/assets/Default.de3d07fa.mjs:1518:20)
    at async _render (file:///home/andreclark/Documents/GitHub/lunarium/frontend/dist/assets/Default.de3d07fa.mjs:1443:11)
    at async renderAstroComponent (file:///home/andreclark/Documents/GitHub/lunarium/frontend/dist/assets/Default.de3d07fa.mjs:1694:20)
@AndreBClark
Copy link
Author

AndreBClark commented Jan 21, 2022

appears to work as expected with astro@next. Perhaps this will likely be fixed on the next release for Astro?

@AndreBClark
Copy link
Author

AndreBClark commented Jan 29, 2022

appears to not work with [email protected] with flag.
workaround: disable --experimental-static-build flag

@natemoo-re
Copy link
Owner

Sorry for the delay here! This was fixed in #26. [email protected] should now work with --experimental-static-build enabled.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants