-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
47 lines (37 loc) · 1.07 KB
/
gulpfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
const gulp = require('gulp');
const webpack = require('webpack');
const notifier = require('node-notifier');
const opn = require('opn');
const chalk = require('chalk');
const webpackDevConfig = require('./client/build/webpack.dev');
gulp.task('default', ['watch']);
gulp.task('watch', () => {
process.env.NODE_ENV = 'development';
const compiler = webpack(webpackDevConfig);
console.log(chalk.yellow('[Rephic] Webpack mode:', webpackDevConfig.mode));
console.log(chalk.yellow('[Rephic] Webpack is building...'));
let first = true;
const watching = compiler.watch({
ignored: /node_modules/,
}, (err, stats) => {
webpackOutputHandler(err, stats);
if (first) {
opn('http://localhost:3000');
first = false;
}
});
});
function webpackOutputHandler(err, stats) {
if (err) throw err;
process.stdout.write(stats.toString({
colors: true,
modules: false,
children: false,
chunks: false,
chunkModules: false,
}) + '\n');
// notifier.notify({
// title: 'Notification',
// message: 'Webpack has built assets.',
// });
}