File tree Expand file tree Collapse file tree 3 files changed +42
-2
lines changed Expand file tree Collapse file tree 3 files changed +42
-2
lines changed Original file line number Diff line number Diff line change 88
99bug 或者交流建议等请反馈到 [ mpvue/issues] ( https://github.com/Meituan-Dianping/mpvue/issues ) 。
1010
11+ ## example
12+ ```
13+ const mpvueSimple = require('mpvue-simple')
14+
15+ // build for signel Page
16+ mpvueSimple.build()
17+
18+ // or more options
19+ mpvueSimple.build({
20+ output: 'mp-pages',
21+ pageName: 'login'
22+ })
23+
24+ // or more options
25+ mpvueSimple.build({
26+ output: {
27+ path: 'mp-pages',
28+ jsonpFunction: 'webpackJsonpMpvue' // optional config
29+ },
30+ pageName: 'login'
31+ })
32+
33+ // maybe you want to do something after building
34+ mpvueSimple.build() // => Promise
35+ .then(() => console.log('mpvue build success'))
36+ .catch(err => throw new Error(err))
37+ ```
38+
39+ ## changelog
40+
41+ #### ` 1.0.17 `
42+ - 加入可选配置项 ` output.jsonpFunction ` ,mpvue 打包构建后会在 ` manifest.js ` 中生生成全局的模块加载器函数 ` global.webpackJsonp ` ,为防止和其它构建工具引起命名冲突,该默认函数名可在 output 配置中指定,示例如上。
43+
Original file line number Diff line number Diff line change @@ -132,7 +132,14 @@ function mergeArgvConfig (config) {
132132
133133 // 输出文件夹
134134 if ( argvOutput ) {
135- const assetsRoot = path . resolve ( argvOutput )
135+ let outputPath = argvOutput ;
136+ if ( typeof argvOutput === 'object' ) {
137+ outputPath = argvOutput . path ;
138+ config . argvConfig . output = Object . assign ( { } , argvOutput ) ;
139+ delete config . argvConfig . output . path ;
140+ }
141+
142+ const assetsRoot = path . resolve ( outputPath )
136143 defConfig . assetsRoot = assetsRoot
137144 }
138145
Original file line number Diff line number Diff line change 11{
22 "name" : " mpvue-simple" ,
3- "version" : " 1.0.15 " ,
3+ "version" : " 1.0.17 " ,
44 "description" : " 辅助 mpvue 快速开发 Page / Component 级小程序页面的工具" ,
55 "main" : " index.js" ,
66 "bin" : " bin/mpvue-simple" ,
You can’t perform that action at this time.
0 commit comments