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

Inserting an <Icon /> element into map will fail on first render & all build #15

Closed
Tc-001 opened this issue Dec 13, 2021 · 2 comments · Fixed by #16
Closed

Inserting an <Icon /> element into map will fail on first render & all build #15

Tc-001 opened this issue Dec 13, 2021 · 2 comments · Fixed by #16

Comments

@Tc-001
Copy link

Tc-001 commented Dec 13, 2021

Bug

Adding an Icon component as part of a map operation will fail all but the first icon

Code sample

{[1,2,3].map(() => <Icon name="bi:stars" /> )}

Errors

Dev

on first dev load (2/3 icons missing, everything works after a refresh):

Error: <Icon pack="bi" name="stars" /> did not return an icon!
    at Module.load [as default] (/node_modules/astro-icon/lib/utils.ts:140:13)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
    at async eval (/node_modules/astro-icon/lib/Icon.astro:25:17)
    at async renderToString (/node_modules/astro/dist/runtime/server/index.js?v=b26a95c3:296:21)
    at async Module.renderComponent (/node_modules/astro/dist/runtime/server/index.js?v=b26a95c3:118:20)
    at async _render (/node_modules/astro/dist/runtime/server/index.js?v=b26a95c3:44:11)
    at async renderAstroComponent (/node_modules/astro/dist/runtime/server/index.js?v=b26a95c3:330:20)
    at async _render (/node_modules/astro/dist/runtime/server/index.js?v=b26a95c3:53:12)
    at async Promise.all (index 1)
    at async _render (/node_modules/astro/dist/runtime/server/index.js?v=b26a95c3:46:13)
Error: <Icon pack="bi" name="stars" /> did not return an icon!
	at...
	...

image

Build

Build does not finish, errors out with:

[astro-icon] Unable to load icon "bi:stars"!
Error: <Icon pack="bi" name="stars" /> did not return an icon!
Error: [astro-icon] Unable to load icon "bi:stars"!
Error: <Icon pack="bi" name="stars" /> did not return an icon!
 ELIFECYCLE  Command failed with exit code 1.

CodeSandbox repro

(server controls > restart sandbox > reload the live preview to trigger)
https://codesandbox.io/s/hungry-pike-xrsre?file=/src/pages/index.astro:478-524

@Tc-001 Tc-001 changed the title Inserting an <Icon /> element into map will fail on first render Inserting an <Icon /> element into map will fail on first render & build Dec 13, 2021
@Tc-001 Tc-001 changed the title Inserting an <Icon /> element into map will fail on first render & build Inserting an <Icon /> element into map will fail on first render & all build Dec 13, 2021
@Tc-001
Copy link
Author

Tc-001 commented Dec 13, 2021

The issue stated when I upgraded from 0.4.6 to 0.5.1
Reverting seems to solve this for my simple usecase, at least for now.

@natemoo-re
Copy link
Owner

This should be working in 0.5.2! See working reproduction https://codesandbox.io/s/aged-star-p5jlo?file=/src/pages/index.astro

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

Successfully merging a pull request may close this issue.

2 participants