Webpack Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema

18 views Asked by At

enter image description hereBelow is my code for webpack.config.js file

"use strict";

const webpack = require("webpack");
const TerserPlugin = require("terser-webpack-plugin");

module.exports = {
    entry: {
        "bundle": './Scripts/jsx/index.jsx',
        "bundle.min": './Scripts/jsx/index.jsx'
    },
    output: {
        filename: "./Scripts/js/bundle.js"
    },
    optimization: {
        minimize: true,
        minimizer: [new TerserPlugin()],
    },
    devServer: {
        inline: false,
        contentBase: "./dist",
    },
    module: {
        rules: [
            {
                test: /\.jsx$/,
                loader: "babel-loader",
                exclude: /node_modules/,
                query: {
                    presets: ["env", "react"]
                }
            },
            {
                test: /\.html$/,
                loader: 'html-loader'
            },
            { test: /\.css$/, loader: "style-loader!css-loader" },
            {
                test: /\.png$/,
                loader: "url-loader?limit=100000"
            },
            {
                test: /\.jpg$/,
                loader: "file-loader"
            },
            {
                test: /\.(woff|woff2)(\?v=\d+\.\d+\.\d+)?$/,
                loader: 'url?limit=10000&mimetype=application/font-woff'
            },
            {
                test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/,
                loader: 'url?limit=10000&mimetype=application/octet-stream'
            },
            {
                test: /\.eot(\?v=\d+\.\d+\.\d+)?$/,
                loader: 'file'
            },
            {
                test: /\.svg(\?v=\d+\.\d+\.\d+)?$/,
                loader: 'url?limit=10000&mimetype=image/svg+xml'
            }
        ]
    },
    plugins: [
    
    ]
};

enter image description here Error which i get when i run npm run build for ReactJs app

Please do help me to resolve the error and run the command successfully.

React is the library for web and native user interfaces. Build user interfaces out of individual pieces called components written in JavaScript.

0

There are 0 answers