0

我已经为 css 正确设置了 webpack,但仍然出现错误。请问可能是什么原因?

ERROR in ./src/main/main.css 1:0
Module parse failed: Unexpected token (1:0)
You may need an appropriate loader to handle this file type.
> .whiteBackground {
|    background: white;
| }
 @ ./src/main/main.js 15:12-33
 @ ./src/index.js

这是我的 webpack.config.js

const HtmlWebPackPlugin = require("html-webpack-plugin");

const htmlWebpackPlugin = new HtmlWebPackPlugin({
  template: "./src/index.html",
  filename: "./index.html"
});

module.exports = {
  module: {
    rules: [
      {
        test: /\.js$/,
        exclude: /node_modules/,
        use: {
          loader: "babel-loader"
        }
      },
      {
        test: /\.css$/,
        use: [
          {
            loader: "style-loader"
          },
          {
            loader: "css-loader",
            options: {
              modules: true,
              importLoaders: 1,
              localIdentName: "[name]_[local]_[hash:base64]",
              sourceMap: true,
              minimize: true
            }
          }
        ]
      },
      {
        test: /\.(woff|woff2|ttf|svg|eot)$/,
        use: [
            {
                loader: 'file-loader',
                options: {}
            }
         ]
      }
    ]
  },
  plugins: [htmlWebpackPlugin]
};

/******/ /******/ /******/ /******/ /******/ /******/ /* *****/ /******/ /******/ /******/ /******/ /******/ /*** ***/ /******/ /******/ /******/ /******/ /******/

4

0 回答 0