configuration.module具有未知的属性'use'

时间:2019-11-11 19:36:09

标签: webpack webpack-dev-server webpack-4 webpack-style-loader

我正在尝试构建一个不使用creat-react-app的React应用程序。

这是我的package.config.js:

//configurations for babel loader
const HtmlWebPackPlugin = require("html-webpack-plugin");

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

module.exports = {
    module: {
        rules: [
            {
                test: /\.js$/,
                exclude: /node_modules/,
                use: {
                    loader: "babel-loader"
                }
            }
        ],
        use: [
            {
                loader: "style-loader"
            },
            {
                loader: "css-loader",
                options: {
                    modules: true,
                    importLoaders: 1,
                    localIdentName: "[name]_[local]_[hash:base64]",
                    sourceMap: true,
                    minimize: true
                }
            }
        ]
    },
    plugins: [htmlPlugin]
};

我运行npm start后,控制台上显示的错误消息是:
✖ 「wds」: Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.

0 个答案:

没有答案