Install node.js.
node.js comes with a package manager called npm.
webpack can be installed through npm:
$ npm install webpack -gwebpack is now installed globally and the webpack command is available.
It’s the best to have webpack also as dependency in your project. Through this you can choose a local webpack version and will not be forced to use the single global one.
Add a package.json configuration file for npm with:
$ npm initThe answers to the questions are not so important if you don’t want to publish your project to npm.
Install and add webpack to the package.json with:
$ npm install webpack --save-devThere are two versions of webpack available. The stable one and a beta version. The beta version is marked with a -beta in the version string. The beta version may contain fragile changes or experimental features and is less tested. See changelog for differences. For serious stuff you should use the stable version:
$ npm install webpack@1.2.x --save-devIf you want to use dev tools you should install it:
$ npm install webpack-dev-server --save-devYou can continue reading Usage.