Answer the question
In order to leave comments, you need to log in
How to reload browserSync when working with webpack?
I decided to assemble my own project assembler with blackjack.
I made gulp + webpack, but if I change the content in the js file, then browserSync does not respond to changes.
Here is the webpack task
gulp.task('webpack', function() {
return gulp.src(path.assets + '/javascript/*.js')
.pipe(plumber(configs.plumberError))
.pipe(webpackStream(webpackConfig))
.pipe(gulp.dest(path.public));
});
gulp.watch("js/*.js").on("change", reload);
...
browserConfig: {
server: {
baseDir: './public/'
},
reloadDelay: 1500,
tunnel: false,
host: 'localhost',
port: 3000,
logPrefix: 'FrontEnd Server'
},
...
gulp.task('browser-sync', function() {
browserSync.init(configs.browserConfig);
gulp.watch('js/*.js').on('change', reload);
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question