React Table Css的模块解析失败

时间:2017-12-01 19:48:38

标签: reactjs webpack

我无法导入此内容:import 'react-table/react-table.css'; 我收到这个错误:

ModuleParseError: Module parse failed: /Users/andy/Sites/purpose-www/node_modules/react-table/react-table.css Unexpected token (1:0)
You may need an appropriate loader to handle this file type.

但我已为css-loader设置了webpack配置。这是我的webpack配置:

module: {
    loaders: [
      {
        test: /\.css$/,
        exclude: /node_modules/,
        loader: 'style-loader!css-loader?localIdentName=[name]__[local]__[hash:base64:5]&modules&importLoaders=1&sourceMap!postcss-loader',
      }, {
        test: /\.css$/,
        include: /node_modules/,
        loaders: ['style-loader', 'css-loader'],
      }, {
        test: /\.jsx*$/,
        exclude: [/node_modules/, /.+\.config.js/],
        loader: 'babel',
      }, {
        test: /\.(jpe?g|gif|png|svg)$/i,
        loader: 'url-loader?limit=10000',
      }, {
        test: /\.json$/,
        loader: 'json-loader',
      },
    ],
  },

Bable.rc:

{
  "presets": ["react", "es2015", "stage-0"],
  "plugins": ["react-hot-loader/babel", "react-html-attrs", "transform-class-properties"],
  "env": {
    "production": {
      "presets": ["es2015", "react", "react-optimize", "es2015-native-modules", "stage-0"]
    }
  }
}

有什么想法吗?

0 个答案:

没有答案