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 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 | 1× 1× 1× 1× 1× 1× 6× 1× 1× 1× 1× 1× 1× | /* moduleIdType 决定webpack打包模块的id number,默认的id hash 利用 webpack.HashedModuleIdsPlugin() name 利用webpack.NamedModulesPlugin() chameleon 利用chameleon-webpack-plugin 中开启moduleid的处理 */ var miniappConfig = { dev: { moduleIdType: 'name', definePlugin: { 'process.env.NODE_ENV': JSON.stringify('development') } }, build: { hash: true, minimize: true, definePlugin: { 'process.env.NODE_ENV': JSON.stringify('production') } }, export: { hash: true, minimize: true, definePlugin: { 'process.env.NODE_ENV': JSON.stringify('production') }, entry: [ './components' ], publicPath: '../../' } }; var chameleonConfig = { platforms: ['web', 'weex', 'wx', 'baidu', 'alipay'], // devPort: 8000, // projectName: undefined, templateType: 'html', // 模板类型 smarty or html,决定web页面的格式与dev web服务器的类型 isBuildInProject: false, // 是否是内置组件项目,该项目不嵌入内置组件 devOffPlatform: [], // dev 命令关闭的端 buildOffPlatform: [], // build 命令关闭的端 builtinNpmName: 'chameleon-ui-builtin', // 内置组件npm包的名称 check: { enable: true, // 是否开启接口校验 enableTypes: [] // 接口校验支持的类型 可以开启["Object","Array","Nullable"] }, cmlComponents: [ // 配置node_modules中cml组件库 ], baseStyle: { // 是否插入各端的基础样式 wx: true, web: true, weex: true, alipay: true, baidu: true }, proxy: { enable: false, mapremote: [] }, // entry: { // template: 'entry_test/entry.html', // web: 'entry_test/web.js', // weex: 'entry_test/weex.js' // }, buildInfo: { // 打包信息 wxAppId: '' }, enableLinter: true, enableGlobalCheck: false, globalCheckWhiteList: [ // 全局校验的白名单文件 后缀匹配 ], cmss: { rem: true, scale: 0.5, remOptions: { // base on 750px standard. rootValue: {cpx: 75}, // cpx转rem px不处理 // to leave 1px alone. minPixelValue: null }, autoprefixOptions: { browsers: ['> 0.1%', 'ios >= 8', 'not ie < 12'] } }, wx: miniappConfig, alipay: miniappConfig, baidu: miniappConfig, web: { dev: { babelPolyfill: false, // 是否添加babel polyfill 只web端有此属性 moduleIdType: 'name', hot: false, analysis: false, // apiPrefix: , definePlugin: { 'process.env.NODE_ENV': JSON.stringify('development') } }, build: { babelPolyfill: false, // 是否添加babel polyfill 只web端有此属性 hash: true, minimize: true, moduleIdType: 'chameleon', definePlugin: { 'process.env.NODE_ENV': JSON.stringify('production') } }, export: { hash: true, minimize: true, moduleIdType: 'chameleon', entry: [ './components' ], definePlugin: { 'process.env.NODE_ENV': JSON.stringify('production') } } }, weex: { dev: { moduleIdType: 'name', definePlugin: { 'process.env.NODE_ENV': JSON.stringify('development') } }, build: { minimize: true, hash: true, moduleIdType: 'chameleon', definePlugin: { 'process.env.NODE_ENV': JSON.stringify('production') } }, export: { hash: true, minimize: true, moduleIdType: 'chameleon', entry: [ './components' ], definePlugin: { 'process.env.NODE_ENV': JSON.stringify('production') } } } } var utils = require('./utils.js'); const _ = {}; module.exports = _; _.get = function() { return chameleonConfig; } _.merge = function(mergeConfig) { chameleonConfig = utils.merge(chameleonConfig, mergeConfig); return chameleonConfig; } _.assign = function(mergeConfig) { chameleonConfig = Object.assign(chameleonConfig, mergeConfig); return chameleonConfig; } |