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

[Fresh] Throw in prod and change annotation #15939

Merged
merged 3 commits into from
Jun 20, 2019
Merged

Conversation

gaearon
Copy link
Collaborator

@gaearon gaearon commented Jun 20, 2019

  1. Babel transform now refuses to run in any environment other than development. This is to detect misconfiguration early.
  2. The runtime now throws at initialization if it's included in a production mode bundle. This should never happen and usually points at misconfiguration. I'll verify this doesn't happen in RN.
  3. Changes @hot reset annotation to @refresh reset to match overall naming.

throw new Error(
'React Refresh Babel transform should only be enabled in development environment. ' +
'Instead, the environment is: "' +
env +
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess Prettier did this, seems strange though. :/

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yea

@sizebot
Copy link

sizebot commented Jun 20, 2019

Details of bundled changes.

Comparing: e61c9e0...fddbb52

react-refresh

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-refresh-runtime.production.min.js -74.3% -41.2% 1.4 KB 368 B 451 B 265 B NODE_PROD
react-refresh-babel.development.js +1.4% +2.5% 21.67 KB 21.98 KB 4.65 KB 4.77 KB NODE_DEV
react-refresh-babel.production.min.js 🔺+3.3% 🔺+5.0% 6.3 KB 6.5 KB 2.17 KB 2.27 KB NODE_PROD

Generated by 🚫 dangerJS

@gaearon gaearon merged commit d4f384d into facebook:master Jun 20, 2019
gaearon added a commit to gaearon/react that referenced this pull request Jun 24, 2019
* Disable React Refresh Babel transform in prod

* Throw early if React Refresh runtime is imported in production

* @hot reset -> @refresh reset
rickhanlonii pushed a commit to rickhanlonii/react that referenced this pull request Jun 25, 2019
* Disable React Refresh Babel transform in prod

* Throw early if React Refresh runtime is imported in production

* @hot reset -> @refresh reset
brunolemos added a commit to brunolemos/create-snowpack-app that referenced this pull request Jun 19, 2020
React Refresh only works on development and throws on any other environment.
It's currently making `yarn build` fail.
Ref: facebook/react#15939
FredKSchott pushed a commit to FredKSchott/create-snowpack-app that referenced this pull request Jun 19, 2020
…147)

React Refresh only works on development and throws on any other environment.
It's currently making `yarn build` fail.
Ref: facebook/react#15939
drwpow pushed a commit to FredKSchott/snowpack that referenced this pull request Jul 24, 2020
…147)

React Refresh only works on development and throws on any other environment.
It's currently making `yarn build` fail.
Ref: facebook/react#15939
drwpow pushed a commit to FredKSchott/snowpack that referenced this pull request Jul 27, 2020
…147)

React Refresh only works on development and throws on any other environment.
It's currently making `yarn build` fail.
Ref: facebook/react#15939
drwpow pushed a commit to FredKSchott/snowpack that referenced this pull request Jul 27, 2020
…147)

React Refresh only works on development and throws on any other environment.
It's currently making `yarn build` fail.
Ref: facebook/react#15939
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.

4 participants