Setup react fast refresh config & remove react-hot-loader #9509
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What is fast refresh?
It's essentially a successor to
react-hot-loader
but with first class support in react. https://facebook.github.io/react-native/docs/fast-refreshA few notable improvements:
hot()
it couldn't be hot reloaded. On top of that, if code changed from something that was not hot reloadable everywhere (eg. updated some core component, and not everything that uses it is reloaded), then a full page refresh would occur. This no longer happens. It will try and hot reload everything (much better detection) and if something isn't reloadable you will need to refresh manually.Testing
yarn build:dev
.yarn install
The Repo
I've forked off of https://github.com/pmmmwh/react-refresh-webpack-plugin. The webpack integration may still be a ways off from getting a public implementation which is why I forked it.
Since we apply it only ever in dev mode and it represents such a massive improvement in development experience, I think we should proceed with it even before finalization & official
react-refresh
branding.Even if the implementation changes 100% we don't have anything that ever relies on it's behaviour.
See it actually working