Open kfoubert opened 2 months ago
Same here. I confirm this issue. It shows up after I upgraded React from v18.2.79 to v18.3.2. Can't find a solution so far
[UPDATE]
I've just migrated away from using this plugin because it seems like the issue comes from the dependency, the package svg-react-loader
which is not actively maintained. I've replaced this plugin with gatsby-plugin-svgr
(don't forget also adding the @svgr/webpack
as a dependency). It does the job but I had to slightly adjust the component usage in this manner:
// BEFORE
import MySvg from './my-img.svg';
render <MySvg />;
// NOW
import { ReactComponent as MySvg } from './my-img.svg';
render <MySvg />;
Also, I had to adjust my TypeScript types' definition for the SVG files. It looks like this now:
declare module '*.svg' {
import { FC, SVGProps } from 'react';
export const ReactComponent: FC<SVGProps<SVGElement>>;
}
All my imports for SVG images are showing this error and making it difficult to debug other issues.
Setup
Gatsby 5.13.3 using Typescript gatsby-plugin-react-svg 3.3.0
configs
gatsby-config.ts
svg.d.ts
sample code
Sample Error Browser Warning
There's a lot of them.