-
-
Notifications
You must be signed in to change notification settings - Fork 26.9k
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
Auto reload does not detect changes to index.js #9984
Comments
Yes i've just followed the steps from |
It happened to me as well, I think this is related to the react-refresh / fast-refresh that was introduced in react-script v4. |
Yes — hard to say if it's CRA, pmmmwh/react-refresh-webpack-plugin, React's fast-refresh, or something else altogether :/. For me (different codebase), changes are detected, but the given module/component isn't reloaded/hot-reloaded. |
I just had this happen to me recently. One of the tutorials that I'm following insists on creating all the Components inside |
So am I. Also, when I change export result in function App () { ... }
function Test () { ... }
export default Test; class App extends React.Component () { ... }
export default App; |
It happened to me as well |
The worst (but quite logical) thing about this is that everything that's imported in index is ignored too. Since I'm wrapping my app in an I18nextProvider there, I need to manually refresh each time I change a translation. |
I'm having troubles when changing scss files as well, the app is not updated with changes. Since I update for 4.0. The hot reloading also not working always that I change my components (some time works other not)... very frustrating! |
An issue similar to this is affecting me as well. Changes being made to index.tsx are not triggering a hot reload ( I tested this by adding an extra div element with random text after my component, saving, and checking the DOM for this element. ) I also have a toolbox.ts file that holds my common functions, and it behaves the same way as index.tsx, in that it does not trigger a hot reload. Taking my observations one step further, I found that making changes to either of these two files, and saving, completely breaks the hot reload functionality for my other previously-hot reloading components, until I reload the page. Perhaps this tidbit will point a contributor in the right direction. To be clear this is the behavior I am seeing Navigation.tsx saved If I do not have to touch these two files during my development then the 4.0 hot reload functions as expected. |
I've the same problem here! Waiting for update :P |
Bit of an overkill, but this patched the issue:
Looking forward to having this fixed in "react-scripts": "4.0.0" Thanks @garamb1 for the suggestion. |
It happened to me too |
Please fix this issue ASAP. Its very annoying and killing development experience. |
Its happening same for me. |
Same here, please fix this issue. |
Also another annoying issue: If you have a few warnings over different files after you fix one fix the warnings are clear. So you have to stop and start the dev server to see the warnings again.
For now, I remove version 4 and use 3.4.4 again. I hope it will be solved :-) |
Happens similarly in my index.js file . every time i change something in return statement the browser does not auto reflect the changes only a site refresh is updating the changes. Guess we have to code in app.js for now. |
Same issue here, but I've worked around the issue by simply moving everything out of the index file, and leaving just this: import 'react-app-polyfill/ie11'
import ReactDOM from 'react-dom'
import App from './App'
ReactDOM.render(<App />, document.getElementById('root')) That solved our problems. |
Thanks @mowasfi7. As at version 4.0.1 (react-scripts), the behavior still remains the same; but the suggested quick fix solved it. |
Also experiencing this issue on 4.0.1. Just commenting to thank @mowasfi7 as his suggestion worked for me as well. |
@mowasfi7 Worked for me as well. Thank youu :) |
I'm using Win10 OS and react 16.9.0 and @mowasfi7 's suggestion worked pretty well. |
As a subscriber to this issue I would be very grateful for not being repeatedly notified when the mowasfi7-suggestions works. It's just a downgrade. Every time I see the blue dot I get my hopes up that there's a real fix or at least some kind of new information. 🙏 |
With my OS Windows 10, it works very well. Thank you @mowasfi7 |
+1 |
This solution from Stackoverflow solved this problem for me. You can read about what it does in advanced-configuration.md (url). After that rerun |
…he workaround. details here facebook/create-react-app#9984
Thanks @mowasfi7 Worked for me. |
it works for me now. |
This worked for me as well, thanks 😃 |
Although adding "FAST_REFRESH=false" in the ".env" file solved my problem but the question here is that when this issue will be resolved by React officially. |
This solution worked for me thanks |
Why is default value of FAST_REFRESH create-react-app/packages/react-scripts/config/env.js Lines 98 to 100 in 7e4949a
|
Setting For me, the bug seems to only occur on |
So the issue is because of react-script version 4 and above. |
Please do not close this issue yet because the problem still exist: as @uzair-suria said:
|
but so many packages are depricated in 3.4.4 |
change |
I have the issue in Expo, could this solution solved my problem in Expo? |
All solutions none work. |
Just want to chime in and say this issue is still not resolved. Using react-scripts 4.0.3 and the only work-around I've found to be effective is the .env change that was listed above. PLEASE fix this. A lot of us junk up our index.js, don't shame us! |
Create .env file in the root and type in FAST_REFRESH= false |
this works for me. |
Worked!! |
|
I also had the same problem but I got the fix. |
no solution working for me i made the changes in the code but in the browser, changes are not refleacting |
Did you restart the server after creating .env file with parameter? |
thanks this worked for me! |
if you are on windows use the PowerShell or move the project to WSL (~home/ ) directory |
It`s works. |
this issue still exists wonder why |
Bug Description
The app does not auto reload upon saving changes in
index.js
, but reloads on changes inApp.js
. If there are any changes inindex.js
, then the monitoring ofApp.js
is suspended till the app is reloaded in the browser.Did you try recovering your dependencies?
I have used fresh apps using
npx create-react-app
andyarn create react-app
separately. The issue is there on both apps.Environment
Steps to reproduce
npx create-react-app <appName>
oryarn create react-app <appName>
cd <appName>
and open the app in code editor (code .
for VSCode)npm start
oryarn start
App.js
and save. Confirm that changes are reflected on the browserApp.js
again and save. Confirm that changes are NOT reflected on the browserExpected behavior
I have been learning React for the past few weeks and usually each tutorial started by following commands
... and all the components were usually created inside
index.js
. Up until few days ago, all the saved changes inindex.js
were detected automatically and the app used to refresh to reflect those changesActual behavior
The auto refresh works fine as long as I keep editing
App.js
, but breaks down as soon asindex.js
is edited. Onceindex.js
has been changed, until the app page is manually refreshed, changes inApp.js
won't trigger auto refresh.Reproducible demo
This is the app I created using
yarn create react-app
: yarn-app.zipThe
node_modules
andyarn.lock
have been removed from the zip to reduce file size.Steps to run the demo:
yarn
to install dependenciesThe text was updated successfully, but these errors were encountered: