Javascript 您可能需要适当的加载程序来处理此文件类型…SVG网页

Javascript 您可能需要适当的加载程序来处理此文件类型…SVG网页,javascript,reactjs,svg,webpack,Javascript,Reactjs,Svg,Webpack,我在尝试使用webpack构建组件时遇到问题。 控制台显示以下内容: You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders | | return ( > <svg viewBox={`0 0 ${widt

我在尝试使用webpack构建组件时遇到问题。 控制台显示以下内容:

You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
|
|   return (
>     <svg viewBox={`0 0 ${width} ${height}`} className='simple-line-chart'>
|       <Axis
|         padding={padding} axisLineColor={axisLineColor}
 @ ./src/index.js 8:17-43
我不确定是否必须使用react svg loader,因为我不是在导入svg,而是在创建svg。
谢谢你的支持

您能提供stablitz或codesandbox,并复制问题吗?您好,错误不在组件中,我认为是在加载程序中,这是我所认为的,
svg
元素对我来说工作得非常好。
    rules: [
      {
        test: /\.js?$/,
        exclude: /(node_modules)/,
        loaders: ['babel-loader?presets[]=es2015']
      },
      {
        test: /\.s[ac]ss$/i,
        use: [
          'style-loader',
          'css-loader',
          'sass-loader'
        ]
      },
      {
        test: /\.svg$/,
        use: [
          {
            loader: "react-svg-loader",
            options: {
              jsx: true
            }
          }
        ]
      }
    ],
  }