1

The following setup works like this:

  1. I change a file
  2. gulp tasks kick off that end up changing /file/to/watch.js
  3. nodemon restarts my express server
  4. browserSync.reload() is called
  5. the browsers reload

Ever since updating to node 8.9.4 (I think that's when it happened), this no longer works. Steps 1-4 still happen just fine. But not step 5. I still see the 'browserSync.reload!!!' getting logged in my console, but the browser never reloads. I've tried stepping through the browserSync source code, but I don't get very far before I'm in functions labeled "native code".

Any ideas how to get my browsers reloading again?

return nodemon({
    script: '/path/to/script.js',
    watch: '/file/to/watch.js',
    env: {
        'PORT': 7000
    }
}).on('start', function() {
    // to avoid nodemon being started multiple times
    // thanks @matthisk
    if (!started) {
        cb();
        started = true;
    }

    console.log('browserSync.reload!!!');
    browserSync.reload();
});

UPDATE: I figured out that the problem is that the browser-sync script tag is not being injected. I also found out that if I change the open option from false to true, then it works. I prefer to have that set to false, though, and it used to work that way. Not sure what changed.

nbrustein
  • 727
  • 5
  • 16

0 Answers0