natemoo-re / astro-icon

Inline and sprite-based SVGs in Astro made easy!

Home Page:https://astroicon.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Failed to import SVG containing an <image> element

benruehl opened this issue · comments

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

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