Import SVG in TypeScript React app with Webpack
My problem was that Webpack was misconfigured.
I had, beside others, the following two loader configurations:
module: { rules: [ { test: /\.svg$/, loader: 'url-loader' }, { test : /\.(ttf|eot|svg|woff(2)?)(\?[a-z0-9=&.]+)?$/, loader : 'file-loader' } ]}
The problem was that I had svg
in both rules, therefore webpack used the wrong loader. Removing the svg
part from the second rule solved the issue