webpackbabel-loader

having issues with running webpack in development mode


Im a major noobie in writing code and Im working on creating a website clone using ruby on rails and react redux.

Im currently running into this issue :

[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? }.

this is my 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", "*"]
    }
};

Solution

  • @davidhu gave me the correct answer by replacing query with options.