To install the webpack-cli, we need the first to install the webpack. If you don’t installed webpack then first install webpack.
Also, If you don’t have any sample project then create a sample project for webpack.
Now, We are ready to install the webpack-cli.
npm install webpack-cli --save-dev
Or, Use below shorthand command:
npm i webpack-cli --save-dev
E.g.
c:\xampp\htdocs\tutorials\webpack-tutorial (webpack-tutorial@1.0.0)
? npm i webpack-cli --save-dev
...
+ webpack-cli@3.3.12
added 572 packages from 358 contributors and audited 575 packages in 176.855s
21 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
We have now successfully installed webpack-cli.
We can see the webpack-cli into the devDependencies from the package.json
file as below:
{
..
"devDependencies": {
"webpack-cli": "^3.3.12"
}
}