tbom
Version:
Taobao Open Platform Modules
37 lines (33 loc) • 815 B
JavaScript
;
const gutil = require('gutil');
const utils = require('./utils');
const webpack = require('webpack');
const webpackConfig = require('./webpack.config');
const argv = process.argv;
const isWatch = argv[2] === '-w';
if (isWatch) {
webpack(webpackConfig).watch({
aggregateTimeout: 300,
poll: true
}, function(err, stats) {
if (err) {
throw new gutil.PluginError('webpack:build', err);
}
gutil.log('[webpack:build]', stats.toString({
chunks: false,
colors: true
}));
// utils.buildIndex();
});
return;
}
webpack(webpackConfig).run(function(err, stats) {
if (err) {
throw new gutil.PluginError('webpack:watch', err);
}
gutil.log('[webpack:watch]', stats.toString({
chunks: false,
colors: true
}));
// utils.buildIndex();
});