yarn add @svgr/webpack -D
declare interface SvgrComponent
extends React.StatelessComponent<React.SVGAttributes<SVGElement>> {}
declare module '*.svg' {
const content: SvgrComponent
export default content
}
{
"files": ["custom.d.ts"]
}
config.module.rules = config.module.rules.map(data => {
if (/svg\|/.test(String(data.test)))
data.test = /\.(ico|jpg|jpeg|png|gif|eot|otf|webp|ttf|woff|woff2|cur|ani)(\?.*)?$/;
return data;
});
config.module.rules.push({
test: /\.svg$/,
use: [
{
loader: '@svgr/webpack'
}
]
});
yarn add @svgr/parcel-plugin-svgr -D