-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchameleon.config.js
74 lines (71 loc) · 1.87 KB
/
chameleon.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
// 设置静态资源的线上路径
const publicPath = '//www.static.chameleon.com/cml';
// 设置api请求前缀
const apiPrefix = 'https://api.chameleon.com';
const DuplicatePackageCheckerPlugin = require('duplicate-package-checker-webpack-plugin');
cml.config.merge({
templateLang: "cml",
templateType: "html",
platforms: ["web","weex","wx","alipay","baidu","qq"],
buildInfo: {
wxAppId: '123456'
},
optimize: {
showWarning:true,
},
wx: {
dev: {
},
build: {
apiPrefix
}
},
web: {
dev: {
analysis: true,
console: false,
isWrapComponent: false // 取消默认对组件的包裹
},
build: {
analysis: true,
publicPath: `${publicPath}/web/`,
apiPrefix,
isWrapComponent: false // 取消默认对组件的包裹
}
},
weex: {
dev: {
isWrapComponent: false // 取消默认对组件的包裹
},
build: {
publicPath: `${publicPath}/weex/`,
apiPrefix,
isWrapComponent: false // 取消默认对组件的包裹
},
custom: {
publicPath: `${publicPath}/wx/`,
apiPrefix
}
},
optimize: {
watchNodeModules: true, // 设置为true对于调试 node_modules 里面的内容很有帮助
showWarning: true// 设置为true可以在构建过程中看到警告信息,比如编译过程中引入了同一个npm包的不同版本会在终端输出信息
}
})
cml.utils.plugin('webpackConfig', function({ type, media, webpackConfig }, cb) {
// cb函数用于设置修改后的配置
debugger;
if(media === 'dev'){ //开发阶段引入警告提示
webpackConfig.plugins.forEach((plugin) => {
if(plugin.constructor.name === 'FriendlyErrorsWebpackPlugin'){
plugin.showWarning = true;
}
});
webpackConfig.plugins.push(new DuplicatePackageCheckerPlugin())
}
cb({
type,
media,
webpackConfig
});
});