安装
node.js
安装 node.js.
node.js 包管理器 npm
.
webpack
使用 npm
安装webpack:
$ npm install webpack -g
现在webpack安装到全局 webpack
命令可用.
在项目中使用webpack
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.
添加 package.json
,为 npm
添加配置文件:
$ npm init
The answers to the questions are not so important if you don't want to publish your project to npm.
安装并添加 webpack
到 package.json
:
$ npm install webpack --save-dev
版本
There 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-dev
开发工具
如果你想使用开发工具你必须安装它:
$ npm install webpack-dev-server --save-dev
继续阅读
就绪阅读如何使用.