Closed bebeal closed 1 month ago
get this functionality to work out of the box.
Sure. Which SSR framework are you using? Could you please provide a minimal reproduction?
Vite SSR - here's a single page app that can reproduce https://github.com/bebeal/vite-amplify
closing this issue - I believe the root cause is related to vite https://github.com/vitejs/vite/issues/18034
Problem
When using SVGR with Vite in a Server-Side Rendering (SSR) configuration, the default type definitions provided by SVGR lead to errors during the server-side rendering process.
Using
.svg?react
to import SVGs as React components cause "Invalid tag" errors during server-side rendering.Example
Error
Workaround
A simple workaround is to override the type definitions as follows:
Usage
The updated usage works for both react components and urls, without any errors.
I'm open to discussing further and contributing if we can get this functionality to work out of the box. But feel free to address this as you see fit, I just wanted to bring attention to it.