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

Failed to import SVG containing an <image> element #206

Open
benruehl opened this issue Feb 9, 2024 · 4 comments
Open

Failed to import SVG containing an <image> element #206

benruehl opened this issue Feb 9, 2024 · 4 comments
Labels
wontfix This will not be worked on

Comments

@benruehl
Copy link

benruehl commented Feb 9, 2024

What version of astro-icon are you using?

1.1.0

Astro Info

Astro                    v4.3.5
Node                     v18.18.0
System                   Linux (x64)
Package Manager          unknown
Output                   static
Adapter                  none
Integrations             astro-icon

If this issue only occurs in one browser, which browser is a problem?

No response

Describe the Bug

Upgraded a project from Astro 3.1.0 to 4.3.5 and astro-icon 0.8.0 to 1.1.0.

When I run astro build I get several errors with this pattern:

# astro build
Failed to import "filename": Unexpected element: <image>

When I run astro dev I get similar errors:

# astro dev
Unable to locate "filename" icon!

The respective files are SVG files that contain at least one <image> element. These image elements contain PNG data encoded as base64 which is totally valid SVG and was working fine before the upgrade.

It seems like it doesn't matter if and how the SVG files are imported. Their pure existence causes the error when astro-icon is installed.

What's the expected result?

Build should run without errors when having SVG files with <image> elements in the src directory. Respective SVG files should be importable and usable as an image src, and should be found by the <Icon> component.

Link to Minimal Reproducible Example

https://stackblitz.com/edit/github-ev9r7b?file=package.json

@smissaertj
Copy link

Did you find a workaround for this @natemoo-re ?

@RadoslavPavlinchov
Copy link

Any updates on this one?

@Sum112358
Copy link

Sum112358 commented Nov 4, 2024

This looks to be caused by @iconify/tools parsing methodology, In particular they explicitly declare "<image>" tags in https://github.com/iconify/tools/blob/main/%40iconify/tools/src/svg/data/tags.ts as not supported/bad

@stramel
Copy link
Collaborator

stramel commented Nov 5, 2024

It appears so. This unfortunately is something we won't be able to fix in the current iteration. I believe the new experimental SVG inlining will handle this.

For now, SVGs with an image tag should manually wrap rather than using this library.

@stramel stramel added the wontfix This will not be worked on label Nov 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

5 participants