提交 823af868 编写于 作者: H huyuangang

导出包分离

上级 f1440330
......@@ -5,12 +5,16 @@ const CleanWebpackPlugin = require('clean-webpack-plugin')
var path = require('path');
module.exports = function (config, options) {
let { type, root } = options;
let { type, root, externals } = options;
let outputPath = options.outputPath || path.resolve(root, `dist/export/${type}`);
Object.keys(externals).forEach(key => {
externals[key] = `require('${externals[key]}')`;
})
return merge(config, {
output: {
path: outputPath
},
externals,
plugins: [
new CleanWebpackPlugin(['./*'], {root: outputPath, verbose: false})
]
......
......@@ -11,7 +11,8 @@ module.exports = function(options) {
let {
media,
root,
mode = 'production'
mode = 'production',
externals
} = options;
......@@ -153,6 +154,9 @@ module.exports = function(options) {
]
}
if (externals) {
exportConfig.externals = externals;
}
return merge.smart(getWeexCommonConfig(options), exportConfig)
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册