You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
669 B
JavaScript
32 lines
669 B
JavaScript
'use strict';
|
|
|
|
const gutil = require('gulp-util');
|
|
const webpack = require('webpack');
|
|
const config = require('../config');
|
|
|
|
module.exports = function compile(done) {
|
|
let main = Object.assign({}, require('../../webpack.config.js'));
|
|
let min = Object.assign({}, require('../../webpack.config.min.js'));
|
|
let compiler = webpack([main, min]);
|
|
|
|
let isDone = false;
|
|
function callback(err, stats) {
|
|
if (err) {
|
|
throw new Error(err);
|
|
}
|
|
|
|
gutil.log(stats.toString({ colors: true }));
|
|
|
|
if (!isDone) {
|
|
isDone = true;
|
|
done();
|
|
}
|
|
}
|
|
|
|
if (config.watch) {
|
|
compiler.watch({}, callback);
|
|
} else {
|
|
compiler.run(callback);
|
|
}
|
|
};
|