0

I tried to configure web pack for reacts web app, it kept telling me to use npm install -D webpack-cli :

The CLI moved into a separate package: webpack-cli.
Please install 'webpack-cli' in addition to webpack itself to use the CLI.
-> When using npm: npm install webpack-cli -D
-> When using yarn: yarn add webpack-cli -D
module.js:557
    throw err;
    ^

when I did what it was asking me it gave me this error :

 C:\Users\Desktop\lazabre1>webpack-dev-server
C:\Users\Desktop\lazabre1\webpack.config.js:59
        new webpack.NoErrorsPlugin()
        ^

this is my webpack.config.js file :

var webpack = require('webpack');
var path = require('path');

module.exports = {
    devtool: 'inline-source-map',
    entry: [
        'webpack-dev-server/client?http://127.0.0.1:8080/',
        'webpack/hot/only-dev-server',
        './src'

    ],

    output: {

        path: path.join(__dirname, 'public'),

        filename: 'bundle.js'

    },

    resolve: {
        modulesDirectories: ['node_modules', 'src'],
        extensions: ['', '.js']
    },
    module: {
        loaders: [
        {
            test: /\.jsx?$/,
            exclude: /node_modules/,
            loaders: ['react-hot', 'babel?presets[]=react,presets[]=es2015']
        }
        ]
    },
    plugins: [
        new webpack.HotModuleReplacementPlugin(),
        new webpack.NoErrorsPlugin()
    ]

};

I have 2 questions: first - how to solve this problem //
second - what is the difference between npm install webpack and npm install webpack-cli.

1 Answer 1

1

You are using a configuration file written for Webpack 1 (I guess, by the use of the module.loader key and the NoErrorsPlugin) and using Webpack 4 (if you did not specify otherwise, and by the request to use the CLI which is not included by default anymore).

Upgrade your configuration by following the documentation and update the NoErrorsPlugin.

The webpack-cli is a package to use webpack from the command-line tool (what you are trying to do).

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.