@aomi/webapp-cli
Version:
a web app cli
36 lines (35 loc) • 1 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.execute = void 0;
const compiler_1 = require("../utils/compiler");
/**
* 执行打包任务
* @author 田尘殇Sean(sean.snow@live.com) create at 2018/10/3
*/
function execute() {
const compiler = (0, compiler_1.getCompiler)('prod');
compiler.run((err, stats) => {
if (err) {
console.error(err.stack || err);
if (err.details) {
console.error(err.details);
}
return;
}
let method = 'log';
if (stats.hasErrors()) {
method = 'error';
}
else if (stats.hasWarnings()) {
method = 'warn';
}
console[method](stats.toString({
chunks: false,
colors: true // Shows colors in the console
}));
compiler.close((e, r) => {
e && console.log('关闭compiler失败', e);
});
});
}
exports.execute = execute;