Skip to content

HMR not working when fixing errors #6694

Closed
@lstkz

Description

@lstkz

Is this a bug report?

Yes.

Did you try recovering your dependencies?

Yes

Which terms did you search for in User Guide?

HMR, hot-reloading

Environment

"react-scripts": "2.1.8"

Steps to Reproduce

  1. Enable HMR. Wrap the main render method with module.hot.accept(.
  2. Edit a component and add throw new Error('boo') somewhere.
  3. An error overlay should be visible.
  4. Remove the error statement.
  5. The page is hard-reloading instead of patching.

Expected Behavior

The page should not hard-reload.

Actual Behavior

The page is hard-reloading.
Here is the full video https://take.ms/DjMTV. You can see that console logs are disappearing, and it means hard-reload.
HMR works correctly if I update something without errors.

redbox-react works correctly, and it's possible to implement HMR on errors, but CRA uses a different library.

Reproducible Demo

Repo

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions