You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
...If titleProp is set to true and no title is provided (title={undefined}) at render time, this will fallback to an existing title element in the svg if exists.
But, setting titleProp: true in Next.js webpack doesn't add title even if the SVG itself has a title element in it.
Note that I'm using typescript in my project
To Reproduce
Create a Nextjs project and configure SVGR in it
config.module.rules.push({test: /\.svg$/i,issuer: /\.[jt]sx?$/,// { not: /\.(css|scss|sass)$/ },resourceQuery: /svgr/,// only use svgr to load svg if path ends with *.svg?svgruse: [{loader: "@svgr/webpack",options:{titleProp: true,// default is falsedescProp: true,// default is false}}],});
Create an SVG with <title> element in it
import the ReactSvgImport into any component in React import SVG from './../abc.svg?svgr
Use the imported SVG in React JSX <ReactSvgImport />
Expected behavior
The resultant SVG in DOM should fallback to the existing title element from the root SVG
The text was updated successfully, but these errors were encountered:
🐛 Bug Report
The documentation says that
But, setting
titleProp: true
in Next.js webpack doesn't add title even if the SVG itself has a title element in it.To Reproduce
<title>
element in itimport SVG from './../abc.svg?svgr
<ReactSvgImport />
Expected behavior
The resultant SVG in DOM should fallback to the existing title element from the root SVG
The text was updated successfully, but these errors were encountered: