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

[HMR] Edit files will cause full page reload. #2972

Closed
SidKwok opened this issue Aug 18, 2017 · 2 comments
Closed

[HMR] Edit files will cause full page reload. #2972

SidKwok opened this issue Aug 18, 2017 · 2 comments

Comments

@SidKwok
Copy link

SidKwok commented Aug 18, 2017

Is this a bug report?

Yes

Can you also reproduce the problem with npm 4.x?

yes

Which terms did you search for in User Guide?

(Write your answer here if relevant.)
not relevant

Environment

  1. node -v: 7.6
  2. npm -v: 4.3
  3. yarn --version (if you use Yarn): 0.27.5
  4. npm ls react-scripts (if you haven’t ejected): 1.0.11

Then, specify:

  1. Operating system: macOS 10.12.6
  2. Browser and version (if relevant): chrome 60.0.3112.90

Steps to Reproduce

(Write your steps here:)

  1. edit src/App.js
  2. save

Expected Behavior

Only specific area will change.

Actual Behavior

Full page reload

Reproducible Demo

(Paste the link to an example project and exact instructions to reproduce the issue.)

Thoughts

webpack2 doesn't seem to have such issue.

@gaearon
Copy link
Contributor

gaearon commented Aug 18, 2017

This is not a bug but expected.
#93

We may implement hot reloading of React components in the future (there is a pending PR) but we haven't had time to finish it yet.

You can use module.accept calls as explained in the linked issue to implement something manual yourself, although this won't preserve the state of components.

@AzrizHaziq
Copy link

For those who are using with Typescript and has error Property 'hot' does not exist on type 'NodeModules'

add this line in react-app-env.d.ts

/// <reference types="react-scripts" />

declare var module: NodeModule;
interface NodeModule {
    hot: any     // this is only a temporary answer  😄
}

@lock lock bot locked and limited conversation to collaborators Jan 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants