Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

donalffons
Copy link
Contributor

This fixes an error message that I got while using HMR in webpack-dev-server with target: "webworker". The error message can be reproduced with the example linked in this comment. @alexander-akait suggested to make a PR with a fix.

This PR just checks typeof window before calling window.location.reload() and changes the warning messages slightly when the page cannot be reloaded by webpack.

What kind of change does this PR introduce?

bugfix.

Did you add tests for your changes?

I tried to, but then I realized that the file /hot/dev-server.js is not tested anywhere, yet. Setting up a test scenario from scratch seems like a very hard thing to do 😉.

I tested this manually with the example above to make sure it works as intended.
image

Does this PR introduce a breaking change?

no.

What needs to be documented once your changes are merged?

nothing.

PS: Thank you all for your fantastic work with this project!

@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented May 24, 2022

CLA Signed

The committers listed above are authorized under a signed CLA.

@webpack-bot
Copy link
Contributor

For maintainers only:

  • This needs to be documented (issue in webpack/webpack.js.org will be filed when merged)
  • This needs to be backported to webpack 4 (issue will be created when merged)

@donalffons
Copy link
Contributor Author

The CLA signature website gives me a 502 error. Will try again later.

@webpack-bot
Copy link
Contributor

Hi @donalffons.

Just a little hint from a friendly bot about the best practice when submitting pull requests:

Don't submit pull request from your own main branch. It's recommended to create a feature branch for the PR.

You don't have to change it for this PR, just make sure to follow this hint the next time you submit a PR.

@sokra sokra merged commit aa560ad into webpack:main Nov 9, 2022
@sokra
Copy link
Member

sokra commented Nov 9, 2022

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants