Scenario: npm run webpack the compilation is done and then the plugin open the webpage, at this point you start to do some changes on your code; the expected behavior is to see react-hot-loader in action and watch the how the page changes, but with this plugin the first time you do changes nothing happen, instead you have to do other change to your code file and you start to see the expected result;
I did some research and turns out https://github.com/baldore/open-browser-webpack-plugin/blob/master/index.js#L43 this line is responsible for the error is not throwing any particular error it just doesn't reload your changes the first time, my workaround was remove that line and a new variable to the validation, is not properly tested for all scenarios so I leave that to your consideration, is just for testing at this point... I'm sure there is a more elegant way to fix it.
var alreadyOpen = false;
compiler.plugin('done', function doneCallback(stats) {
if (!alreadyOpen){
open(url, browser, function(err) {
if (err) throw err;
alreadyOpen = true;
});
}
});
Scenario:
npm run webpack
the compilation is done and then the plugin open the webpage, at this point you start to do some changes on your code; the expected behavior is to see react-hot-loader in action and watch the how the page changes, but with this plugin the first time you do changes nothing happen, instead you have to do other change to your code file and you start to see the expected result;I did some research and turns out https://github.com/baldore/open-browser-webpack-plugin/blob/master/index.js#L43 this line is responsible for the
error
is not throwing any particular error it just doesn't reload your changes the first time, my workaround was remove that line and a new variable to the validation, is not properly tested for all scenarios so I leave that to your consideration, is just for testing at this point... I'm sure there is a more elegant way to fix it.