Rade
Rade

Reputation: 79

Webpack Invalid configuration object

I'm receiving some error with webpack like:

Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema. - configuration.resolve has an unknown property 'extension'. These properties are valid: object { alias?, aliasFields?, cachePredicate?, cacheWithContext?, concord?, descriptionFiles?, enforceExtension?, enforceModuleExtension?, extensions?, fileSystem?, mainFields?, mainFiles?, moduleExtensions?, modules?, plugins?, resolver?, symlinks?, unsafeCache?, useSyncFileSystemCalls? } -> Options for the resolver npm ERR! code ELIFECYCLE

This is my webpack.config.js

module.exports = {
    entry: [
        './src/index.js'
    ],
    output: {
        path: __dirname + '/dist',
        publicPath: '/', 
        filename: 'bundle.js'
    },
    devServer: {
        contentBase: './dist'
    },
    module: {
        rules: [{
            test: /\.(js|jsx)$/,
            exclude: /node_modules/,
            use: ['babel-loader']
        },
        {
            test: /\.(js|jsx)$/,
            exclude: /node_modules/,
            use: ['eslint-loader']
        }
        ]
    },
    resolve:{
        extension: ['.js', '.jsx']
    }
}

Upvotes: 2

Views: 907

Answers (1)

Tony
Tony

Reputation: 20082

There is only extensions config in webpack

Try to change your code like this

resolve:{
        extensions: ['.js', '.jsx']
    }

Upvotes: 1

Related Questions