Merge branch 'hot-module-reload' into release-2.0

# Conflicts:
#	packages/modules-runtime-hot/package.js
#	packages/react-fast-refresh/README.md
This commit is contained in:
filipenevola
2021-01-18 17:27:29 -04:00
6 changed files with 25 additions and 5 deletions

View File

@@ -1,7 +1,7 @@
Package.describe({
name: "modules-runtime-hot",
version: "0.13.0-rc200.1",
summary: "Patches modules-runtime to support Hot Module Reload",
summary: "Patches modules-runtime to support Hot Module Replacement",
git: "https://github.com/benjamn/install",
documentation: "README.md"
});

View File

@@ -1,3 +1,15 @@
# react-fast-refresh
[Source code of released version](https://github.com/meteor/meteor/tree/master/packages/react-fast-refresh) | [Source code of development version](https://github.com/meteor/meteor/tree/devel/packages/react-fast-refresh)
***
Automatically update React components with HMR
This package updates modified React components in the running app for faster
feedback after changing a file. To be enabled, your app must:
- Use the `hot-module-replacement` package
- Use React 16.9.0 or newer
This package is disabled in production. It currently only supports the modern web client.
Learn more in the [React Fast Refresh docs](https://reactnative.dev/docs/fast-refresh)
React Fast Refresh can be disabled by setting the `DISABLE_REACT_FAST_REFRESH` environment variable before starting Meteor.

View File

@@ -1,4 +1,6 @@
if (process.env.NODE_ENV !== 'production' && module.hot) {
const enabled = __meteor_runtime_config__.reactFastRefreshEnabled;
if (enabled && process.env.NODE_ENV !== 'production' && module.hot) {
const runtime = require('react-refresh/runtime');
let timeout = null;

View File

@@ -7,7 +7,7 @@ Package.describe({
});
Npm.depends({
'react-refresh': '0.8.3',
'react-refresh': '0.9.0',
semver: '7.3.4'
});

View File

@@ -15,6 +15,10 @@ if (enabled) {
}
}
if (typeof __meteor_runtime_config__ === 'object') {
__meteor_runtime_config__.reactFastRefreshEnabled = enabled;
}
const babelPlugin = enabled ?
require('react-refresh/babel') :
null;

View File

@@ -226,7 +226,9 @@ _.extend(AppProcess.prototype, {
env.METEOR_PRINT_ON_LISTEN = 'true';
env.METEOR_HMR_SECRET = self.hmrSecret;
if (self.hmrSecret) {
env.METEOR_HMR_SECRET = self.hmrSecret;
}
return env;
},