-
Notifications
You must be signed in to change notification settings - Fork 5
/
gulpfile.babel.js
28 lines (25 loc) · 905 Bytes
/
gulpfile.babel.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
import gulp from 'gulp';
import gutil from 'gulp-util';
import livereload from 'gulp-livereload';
import webpack from 'webpack';
import WebpackStream from 'webpack-stream';
import WebpackDevServer from 'webpack-dev-server';
import WebpackConfig from './webpack.config.js';
gulp.task('default', () => {
return gulp
.src('src/entry.js')
.pipe(WebpackStream(WebpackConfig))
.pipe(gulp.dest('dist/'));
});
gulp.task("server", callback => {
let compiler = webpack(WebpackConfig);
new WebpackDevServer(compiler, {}).listen(8080, "localhost", err => {
if (err)
throw new gutil.PluginError("webpack-dev-server", err);
gutil.log("[webpack-dev-server]", "http://localhost:8080/webpack-dev-server/index.html");
});
});
gulp.task('watch', function() {
livereload.listen();
gulp.watch('dist/app.bundle.js', () => livereload.reload());
});