From 81bbb6aee00839a98ad3f87482203d6a503f14d8 Mon Sep 17 00:00:00 2001 From: Anton Korzunov Date: Sat, 27 Jul 2019 14:41:13 +1000 Subject: [PATCH 1/3] fix: apend react-hot-dom patch note to the ProxyFacade, fixes #1311 --- src/proxy/createClassProxy.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/proxy/createClassProxy.js b/src/proxy/createClassProxy.js index e23f084a4..dcea3aa9b 100644 --- a/src/proxy/createClassProxy.js +++ b/src/proxy/createClassProxy.js @@ -261,6 +261,17 @@ function createClassProxy(InitialComponent, proxyKey, options = {}) { // eslint-disable-next-line func-names ProxyFacade = function(props, context) { + /* + + ! THIS IS NOT YOUR COMPONENT ! + ! THIS IS REACT-HOT-LOADER ! + + And you probably looking for a function component of yours + Easy - just reconfigure your application a bit + see https://github.com/gaearon/react-hot-loader/issues/1311 + + */ + const result = CurrentComponent(props, context); // This is a Relay-style container constructor. We can't do the prototype- From 608982277d7936ac0fa8d0b40eaa1d3ea0e6b378 Mon Sep 17 00:00:00 2001 From: Anton Korzunov Date: Sat, 27 Jul 2019 15:22:34 +1000 Subject: [PATCH 2/3] fix: use void IIFE for webpack plugin, fixes #1309 --- .prettierignore | 3 +-- src/webpack/index.js | 3 ++- src/webpack/webpackTagCommonJSExports.js | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.prettierignore b/.prettierignore index 199d45f1c..b625db5e9 100644 --- a/.prettierignore +++ b/.prettierignore @@ -10,5 +10,4 @@ index.js patch.js root.js test/hot/react-dom -coverage -src/webpack/webpackTagCommonJSExports.js +coverage \ No newline at end of file diff --git a/src/webpack/index.js b/src/webpack/index.js index b545e2b1a..bffc84d38 100644 --- a/src/webpack/index.js +++ b/src/webpack/index.js @@ -49,6 +49,7 @@ function transform(source, map) { // Ideally we'd opt out for one file but this is simpler. .replace(/['"]use strict['"];/, '') // eslint comments don't need to end up in the output + .replace(/\/\* (.*) \*\//, '') .replace(/\/\/ eslint-disable-line .*\n/g, '\n') .replace(/\/\* global.*\*\//, '') .split(/\n\s*/) @@ -56,7 +57,7 @@ function transform(source, map) { } // Parameterize the helper with the current filename. - const separator = '\n\n;'; + const separator = '\n'; const appendText = tagCommonJSExportsSource.replace(/__FILENAME__/g, JSON.stringify(resourcePath)); if (this.sourceMap === false) { diff --git a/src/webpack/webpackTagCommonJSExports.js b/src/webpack/webpackTagCommonJSExports.js index d6de252c0..80cc77bf9 100644 --- a/src/webpack/webpackTagCommonJSExports.js +++ b/src/webpack/webpackTagCommonJSExports.js @@ -1,7 +1,7 @@ /* eslint-disable global-require, import/no-unresolved, no-var, camelcase, func-names */ /* global __FILENAME__, reactHotLoaderGlobal */ -;(function register() { +void (function register() { // eslint-disable-line no-extra-semi /* react-hot-loader/webpack */ var safe_require = function() { From 43fc5fd70caa6871d6be570338eff0c6b62107f4 Mon Sep 17 00:00:00 2001 From: Anton Korzunov Date: Sat, 27 Jul 2019 15:48:14 +1000 Subject: [PATCH 3/3] linting --- src/proxy/createClassProxy.js | 4 ++-- src/webpack/webpackTagCommonJSExports.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/proxy/createClassProxy.js b/src/proxy/createClassProxy.js index dcea3aa9b..eb489bd3f 100644 --- a/src/proxy/createClassProxy.js +++ b/src/proxy/createClassProxy.js @@ -266,8 +266,8 @@ function createClassProxy(InitialComponent, proxyKey, options = {}) { ! THIS IS NOT YOUR COMPONENT ! ! THIS IS REACT-HOT-LOADER ! - And you probably looking for a function component of yours - Easy - just reconfigure your application a bit + And you are probably looking for a function component of yours + It's hidden, but there is a way to fix this - just reconfigure your application a bit see https://github.com/gaearon/react-hot-loader/issues/1311 */ diff --git a/src/webpack/webpackTagCommonJSExports.js b/src/webpack/webpackTagCommonJSExports.js index 80cc77bf9..5487425e4 100644 --- a/src/webpack/webpackTagCommonJSExports.js +++ b/src/webpack/webpackTagCommonJSExports.js @@ -1,4 +1,4 @@ -/* eslint-disable global-require, import/no-unresolved, no-var, camelcase, func-names */ +/* eslint-disable global-require, import/no-unresolved, no-var, camelcase, func-names, no-void */ /* global __FILENAME__, reactHotLoaderGlobal */ void (function register() {