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
Compatibility with Astro framework #55
Comments
@pReya I'm running into this as well. I took a look at your example, and it only actually seems to show the error once I added Smiley to the IconContainer—simply importing it did not seem to reproduce. I'm very curious what changed as well, because the legacy phosphor-react library worked fine with Astro. Things I've tried
All to no avail unfortunately. I'm going to just have to downgrade to using |
A workaround for me is currently to use the raw svg files and import them with https://github.com/pd4d10/vite-plugin-svgr as React components. This problem might be fixed just by adding |
@pReya Wow, no kidding, this fixed it! |
Just in case my PR doesn't go through, I wrote a small blog post about how I'm implementing this for now without needing to use the vite plugin: https://adamtaylor.me/posts/fixing-a-minor-inconvenience-with-phosphor-icons/ |
Thanks @pReya for flagging, and @adamtaylor13 for the fix and for the lovely writeup! v2.0.10 had been published with the |
I'm trying to use Phosphor icons in an Astro project. Astro is a meta-framework similar to Next.js, which allows you to decide whether a React component is generated on the server (SSG), rendered on the server for every request (SSR) or shipped to the client like adefault React SPA.
By default, a React component in Astro will be generated on the server and then shipped to the client as static HTML.
However, this does currently not work with Phosphor Icons. There is an error in the build process:
I've prepared a minimal example: https://stackblitz.com/edit/github-rbetns?file=src%2Fcomponents%2FIconContainer.tsx
This seems to be related to the
IconContext
– even though I haven't added any. Is there a way to disable/not use the Context at all and still import the React components for the icons?The text was updated successfully, but these errors were encountered: