N
N
Nikita Nafranets2016-10-20 21:57:50
JavaScript
Nikita Nafranets, 2016-10-20 21:57:50

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));
});

And with browserSync I suffered in different ways, but there is no result. I inserted it
gulp.watch("js/*.js").on("change", reload);
wherever I could, but there is no reaction, not even errors :(
Here is the browserSync task itself
...
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);
});

Tried to manually reload using gulp-watch, but that didn't work either. How can I make it reload on file changes? Thanks in advance.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
sinneren, 2016-10-21
@sinneren

.pipe(browserSync.stream());

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question