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

React: Fix fast refresh #12535

Merged
merged 3 commits into from
Sep 21, 2020
Merged

React: Fix fast refresh #12535

merged 3 commits into from
Sep 21, 2020

Conversation

yannbf
Copy link
Member

@yannbf yannbf commented Sep 21, 2020

What I did

In 6.1 alpha, support for React fast refresh was added. Unfortunately the fast refresh config ended up adding a new babel-loader rather than integrating the rules with the existing loader. This PR fixes that by separating the webpack and babel work in the react preset.

The fast refresh example component + story was moved from official-storybook to cra-kitchen-sink, given that the official-storybook is deliberately removing the babel loader and adding a custom one.

How to test

yarn bootstrap
yarn --cwd examples/cra-kitchen-sink storybook and tweak with either the reactOptions in main.js or add REACT_REFRESH=true then change to false in the .env file.

- Rather than in the webpack config, set it in babel, so that
 there aren't multiple loaders and instead just the plugin is added
 together with the presets.
 Examples were moved to cra-kitchen-sink because official removes
 the babel-loader taht comes from storybook.
@ndelangen
Copy link
Member

Awesome!

@shilman shilman added react and removed release labels Sep 21, 2020
@shilman shilman changed the title React: fix fast refresh support React: Fix fast refresh support Sep 21, 2020
Copy link
Member

@shilman shilman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great @yannbf

@shilman shilman added this to the 6.1 perf milestone Sep 21, 2020
@shilman shilman changed the title React: Fix fast refresh support React: Fix fast refresh Sep 21, 2020
@shilman shilman merged commit 12689d2 into next Sep 21, 2020
@shilman shilman deleted the fix/fast-refresh branch September 21, 2020 16:42
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.

3 participants