UNPKG

1.74 kBMarkdownView Raw
1# amd-deploy
2
3## 功能
4
5* 支持打包合并
6* 支持资源替换,便于缓存控制
7
8## 配置
9
10```
11{
12 // baseUrl 指向的本地硬盘路径
13 baseUrl: '',
14
15 // amd paths
16 paths: { },
17
18 // amd packages
19 packages: [ ]
20}
21```
22
23## 替换资源
24
25```
26{
27 // 资源 ID 替换,如 require('underscore')
28 // raw 表示代码中写的字面量,即 underscore
29 // absolute 表示硬盘中的文件路径,如 project/dep/underscore/1.0.0/src/underscore.js
30 replaceRequireResource: function (raw, absolute) {
31 return raw + Date.now();
32 },
33
34 // 替换 require.config 中的一些值,比如 src 转为 asset
35 replaceRequireConfig: function (config) {
36 if (config.baseUrl) {
37 config.baseUrl = config.baseUrl.replace('url', 'asset');
38 }
39 return config;
40 }
41}
42```
43
44## 模块合并
45
46```
47{
48 combine: {
49 // 全局要合并的模块
50 include: [
51 'json2'
52 ],
53 // 全局不合并的模块
54 exclude: [
55 'cobble',
56 'cobble/**/*'
57 ],
58
59 // 模块默认按自己的依赖进行合并(不合并 build 个毛...)
60 // 只有配置成 false 才表示不需要合并(给你不合并的权利)
61 // 每个模块还可以配置 include 和 exclude,优先级比全局 include exclude 更高,即
62 // 如果 combine.include 包含了一些模块,module.exclude 可以去掉
63 // 如果 combine.exclude 排除了一些模块,module.include 可以加上
64
65 // exclude 和 moduleId 支持模糊匹配,规则请参考 glob
66 modules: {
67 moduleId: {
68 include: [ ],
69 exclude: [ ]
70 }
71 }
72 }
73}
74```
\No newline at end of file