-
Notifications
You must be signed in to change notification settings - Fork 27.8k
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
[next-image-loader] "TypeError: Invalid SVG" when importing SVG sprites #26176
Comments
I'm also having issues with importing SVGs. I use babel-plugin-inline-react-svg to load SVGs, but it is no longer allowing the imported SVGs to be used as components in templates after the Next 11 update |
I also have this issue with export const MySVG = ({ ...otherProps }) => (
<svg {...otherProps}>
...
</svg>
) Of course, this is not a scalable solution. It would be nice to have proper support for |
Thanks for reporting this issue! I'm going to close and merge with the similar issue #26130. |
This PR does a couple things: 1. Omit svg static imports if the user has defined custom webpack config with svg rule 2. Change TS type to `any` for svg imports to avoid conflicts with other plugins The idea is that some users want to use `next/image` with static imports for most image types but not for svg and instead inline those images with a plugin. - Fixes #25950 - Fixes #26130 - Fixes #26176 - Fixes #26196 - Fixes #26067 ## Bug - [x] Related issues linked using Fixes #26130 - [x] Integration tests added
…6281) This PR does a couple things: 1. Omit svg static imports if the user has defined custom webpack config with svg rule 2. Change TS type to `any` for svg imports to avoid conflicts with other plugins The idea is that some users want to use `next/image` with static imports for most image types but not for svg and instead inline those images with a plugin. - Fixes vercel#25950 - Fixes vercel#26130 - Fixes vercel#26176 - Fixes vercel#26196 - Fixes vercel#26067 ## Bug - [x] Related issues linked using Fixes vercel#26130 - [x] Integration tests added
This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
What version of Next.js are you using?
11.0.0
What version of Node.js are you using?
v14.15.1
What browser are you using?
What operating system are you using?
macOS
How are you deploying your application?
Other platform
Describe the Bug
When a svg sprite (like this one) is imported "TypeError: Invalid SVG" is thrown on build.
Expected Behavior
The import should return the StaticImageData with an empty placeholder without throwing an error.
To Reproduce
import logo from "./logo-header.svg"
)next build
The text was updated successfully, but these errors were encountered: