Open
Description
Is your proposal related to a problem?
When running npm run start
, the browser opens almost immediately leaving a blank page for a good few seconds before the code is actually compiled.
Describe the solution you'd like
It would be better if the browser only gets invoked after compilation has passed.
Additional context
This can be achieved easily with WebpackDevServer hooks as with the following snippet:
let compiledOnce = false;
// After WebpackDevServer compiles the bundle, open it in the browser.
compiler.hooks.afterCompile.tap(appName, () => {
if (!compiledOnce) {
openBrowser(urls.localUrlForBrowser);
}
compiledOnce = true;
});
(Maybe someone can help me with that ugly boolean variable that is required to prevent new tabs when hot reloading)