webpack.build.js
根
/
src /
webpack.build.js
var webpack = require('webpack');
var webpackConfigBuild = require('./webpack.config.build.js');
var webpackBuild = function (config) {
var webpackConfig = webpackConfigBuild(config);
console.log('开始打包');
webpack(webpackConfig, (err, stats) => {
if (err || stats.hasErrors()) {
console.log(err);
console.log(stats.compilation.errors);
// 构建过程出错
console.error('打包失败');
return;
}
// console.log(stats);
console.log('打包成功');
});
};
module.exports = webpackBuild;