Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how can two BrowserWindow with different URL(load different html file) Hot Reload at same time? #2930

Closed
HyperClockUp opened this issue Jul 22, 2021 · 2 comments
Labels

Comments

@HyperClockUp
Copy link

Summary

i want to run two browserWindow at same time, so i create a new html file as the template of a new BrowserWindow, and then i add a new entry in webpack config. When I running the elelctron, and do some code changes and save, the devtool of electron crashed. I consider if is the two hmr clients receiving the same message make the crash?

@HyperClockUp
Copy link
Author

HyperClockUp commented Jul 22, 2021

webpack/webpack-dev-server#2792
maybe it's something wrong with webpack...
xuya227939/blog#120
webpack/webpack-dev-server#2969

@HyperClockUp
Copy link
Author

never mind this issue, i find the problem is that i didn't set the directory of module.hot.
before:

document.addEventListener('DOMContentLoaded', () => {
  // eslint-disable-next-line global-require
  const Root = require('./containers/Root').default;
  render(
    <AppContainer>
      <Root store={store} history={history} />
    </AppContainer>,
    document.getElementById('root')
  );
});
document.addEventListener('DOMContentLoaded', renderApp);

now:

const renderApp = () => {
  // eslint-disable-next-line global-require
  const NextRoot = require('./containers/Root').default;
  render(
    <AppContainer>
      <NextRoot store={store} history={history} />
    </AppContainer>,
    document.getElementById('root')
  );
};
if (module.hot) {
  module.hot.accept('./containers/Root', renderApp);
}

and thanks to electron-react-boilerplate, help me a lot! thank you! @jp887

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant