1 | ## 特性
|
2 | - 简化 webpack 的配置,更人性化的配置参数
|
3 | - 安装命令行工具(xdc-cli)快速搭建项目且无需重复安装依赖,基于 webpack 2
|
4 | - 兼容 webpack 1 和 2,只需同一套配置
|
5 | - 生成的配置完全兼容 webapck 的命令行工具
|
6 |
|
7 | ## 安装
|
8 |
|
9 | 运行环境
|
10 | - Node.js 4+
|
11 | - npm 3+
|
12 | - Python 2.7.x
|
13 |
|
14 |
|
15 | ### 使用 xdc 命令行工具
|
16 | ```shell
|
17 | npm i xdc-cli -g
|
18 | ```
|
19 |
|
20 | Step 1. 创建一个 vue 项目 (将自动下载 vue 项目脚手架,只需下载一次)
|
21 | ```shell
|
22 | $ xdc create my-project vue
|
23 | $ cd my-project
|
24 | ```
|
25 |
|
26 | Step 2. 开始开发
|
27 | ```shell
|
28 | $ xdc watch
|
29 | ```
|
30 |
|
31 | ### 只安装 xdc
|
32 | ```shell
|
33 | npm i xdc -S
|
34 |
|
35 | # 安装 webpack 的依赖(例如 webpack 1)
|
36 | npm i babel-core babel-loader css-loader file-loader postcss postcss-loader\
|
37 | html-loader html-webpack-plugin json-loader style-loader url-loader\
|
38 | webpack@1 webpack-dev-server@1 extract-text-webpack-plugin@1 -D
|
39 |
|
40 | # 开始开发
|
41 | node_modules/.bin/xdc watch # or webpack --config xdc.conf.js
|
42 |
|
43 | # 如果全局安装了 xdc-cli 同样可以这样做(运行的依旧是本地项目的 xdc)
|
44 | xdc watch
|
45 | ```
|