I am working on blockchain project and whenever I try to run "npm run dapp"

I get the following error:

[webpack-cli] Invalid options object. Dev Server has been initialized using an options object that does not match the API schema.

  • options has an unknown property 'stats'. These properties are valid: object { allowedHosts?, bonjour?, client?, compress?, devMiddleware?, headers?, historyApiFallback?, host?, hot?, http2?, https?, ipc?, liveReload?, magicHtml?, onAfterSetupMiddleware?, onBeforeSetupMiddleware?, onListening?, open?, port?, proxy?, server?, setupExitSignals?, setupMiddlewares?, static?, watchFiles?, webSocketServer? }

I am using webpack: 5.71.0 webpack-cli: 4.9.2 webpack-dev-server 4.8.1

My webpack.config.json file is as follows

**const path = require('path')
const htmlWebpackPlugin = require('html-webpack-plugin')
require('babel-register')

module.exports = {
    entry: ['@babel/polyfill', './src/app.js'],
    output: {
        path: path.resolve(__dirname, 'dist'),
        filename: 'bundle.js'
    },
    module: {
        rules: [
            {
                test: /\.js$/,
                exclude: /node_modules/,
                use: ['babel-loader']
            }
        ]
    },
    plugins: [
        new htmlWebpackPlugin({
            template: './index.html'
        })
    ],
    mode: 'development',
    devtool: 'inline-source-map',
        devServer: {
        static: {
          directory: path.resolve(__dirname, 'public/'),
        },
        devMiddleware: {
            publicPath: '/dist/'
        },
        port: 3000,
        hot: "only"
    }
}
**
I was expecting dapp application to run and give me webinterface. on http://localhost:8080
1

There are 1 best solutions below

0
saniya ikram On

This specific issue was resolved after following the migration guide of webpack from v3 to v4. Now my webpack.config.dapp.js file section named "devServer" is update as per below: devServer: { static: path.join(__dirname, "dapp"), port: 8000, devMiddleware: { stats: "minimal", },