【问题标题】:having issues with running webpack in development mode在开发模式下运行 webpack 时遇到问题
【发布时间】:2023-01-28 05:06:44
【问题描述】:

我是少校菜鸟在编写代码时,我正致力于使用 ruby​​ on rails 和 react redux 创建网站克隆。

我目前遇到这个问题:

[webpack-cli] Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema.
 - configuration.module.rules[0].use has an unknown property 'query'. These properties are valid:
   object { ident?, loader?, options? }.

这是我的 webpack.config.js:

const path = require('path');

module.exports = {
    context: __dirname,
    entry: './frontend/clone.jsx',
    output: {
        path: path.resolve(__dirname, 'app', 'assets', 'javascripts'),
        filename: 'bundle.js'
    },
    module: {
        rules: [
            {
                test: /\.jsx?$/,
                exclude: /(node_modules)/,
                use: {
                    loader: 'babel-loader',
                    query: {
                        presets: ['@babel/env', '@babel/react']
                    }
                },
            }
        ]
    },
    devtool: 'source-map',
    resolve: {
        extensions: [".js", ".jsx", "*"]
    }
};

【问题讨论】:

  • 尝试用 options 替换 query
  • 泰。这有效

标签: webpack babel-loader


【解决方案1】:

@davidhu 通过用选项替换查询给了我正确的答案。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-05-02
    • 2020-02-11
    • 1970-01-01
    • 2019-11-26
    • 2021-02-05
    • 2015-07-04
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多