Invalid Configuration object

I followed the steps which are given codecademy’s react environmental setup , but i get this error : "Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema. - configuration has an unknown property ‘text’ "
Could you guys please help me with this last step of configuration ?
Thanks in advance.

1 Like

I changed “loaders” to “rules” and it worked for me! I found the answer here:

https://stackoverflow.com/questions/49203841/webpack-4-1-1-configuration-module-has-an-unknown-property-loaders

var HTMLWebpackPlugin = require('html-webpack-plugin');
var HTMLWebpackPluginConfig = new HTMLWebpackPlugin({
    template: __dirname + '/app/index.html',
    filename: 'index.html',
    inject: 'body'
});

module.exports = {
    entry: __dirname + '/app/index.js',
    module: {
        rules: [
            {
                test: /\.js$/,
                exclude: /node_modules/,
                loader: 'babel-loader'
            }
        ]
    },
    output: {
        filename: 'transformed.js',
        path: __dirname + '/build'
    },
    plugins: [HTMLWebpackPluginConfig]
};

I encountered similar problem.

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

  • configuration.module.rules[2].oneOf[1].include should be one of these:
    RegExp | string | function | [(recursive)] | object { and?, exclude?, include?, not?, or?, test? } | [RegExp | string | function | [(recursive)] | object { and?, exclude?, include?, not?, or?, test? }]

It turned out that I was trying to do it in the folder that had “!” exclamation mark in it’s name. All worked out normally when I renamed the folder