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

Compile SVGs as React Components in Dist #191

Open
dcramer opened this issue Jan 23, 2025 · 0 comments
Open

Compile SVGs as React Components in Dist #191

dcramer opened this issue Jan 23, 2025 · 0 comments

Comments

@dcramer
Copy link
Member

dcramer commented Jan 23, 2025

Right now you cannot use this package out of the box in a common place React app (e.g. Vite), due to the way SVGs are bundled.

We should make the distribution package simple build and ship actual components, rather than requiring a specialized loader that understands svg etc.

Current error:

✘ [ERROR] No loader is configured for ".svg" files: ../../node_modules/.pnpm/[email protected][email protected]/node_modules/platformicons/svg_80x80/tauri.svg

    ../../node_modules/.pnpm/[email protected][email protected]/node_modules/platformicons/esmbuild/preload.js:10:74:
      10 │ ...map((icon) => require(`../${f === "lg" ? "svg_80x80" : "svg"}/${icon}.svg`)))
         ╵                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BYK added a commit to getsentry/spotlight that referenced this issue Jan 24, 2025
There's more work to do here, but currently I cannot simply load in
PlatformIcon due to compatibility

getsentry/platformicons#191

At the very least this will help with things like Next.js to grok if its
server/client.


![image](https://github.com/user-attachments/assets/cb27b5dd-72c1-4e34-ac61-69b7a48331e2)

---------

Co-authored-by: Burak Yigit Kaya <[email protected]>
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

1 participant