我们如何在react js中加载Webpack fontello字体

时间:2018-05-26 06:43:27

标签: html css reactjs

我使用的是使用fontello制作的自定义图标字体。当尝试在webpack中使用它时,我收到以下错误: web pack.config

module: {
    loaders: [{
      test: /\.jsx?$/,
      exclude: /node_modules/,
      loader: 'babel',
      query: {
        "presets": ["react", "es2015", "stage-0", "react-hmre"]
      }
    }, {
      test: /\.json?$/,
      loader: 'json'
    }, {
      test: /\.css$/,
      loader: 'style-loader!css-loader'
    }, {test: /\.(eot|svg|ttf|woff|woff2)$/, loader: 'style-loader!css-loader'}
    ]
  }

webpack.production.config

      module: {
    loaders: [{
      test: /\.jsx?$/,
      exclude: /node_modules/,
      loader: 'babel',
      query: {
        "presets": ["es2015", "stage-0", "react"]
      }
    }, {
      test: /\.json?$/,
      loader: 'json'
    }, {
      test: /\.css$/,
      loader: ExtractTextPlugin.extract('style', 'style-loader!css-loader')
    }, {test: /\.(eot|svg|ttf|woff|woff2)$/, loader: ExtractTextPlugin.extract('style', 'style-loader!css-loader')}
    ]
  }

enter image description here

0 个答案:

没有答案