File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed
packages/react-hot-loader/src Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,11 @@ import reactHotLoader from './reactHotLoader'
6
6
import { isOpened as isModuleOpened } from './global/modules'
7
7
import logger from './logger'
8
8
9
+ /* eslint-disable camelcase, no-undef */
10
+ const requireIndirect =
11
+ typeof __webpack_require__ !== 'undefined' ? __webpack_require__ : require
12
+ /* eslint-enable */
13
+
9
14
const createHoc = ( SourceComponent , TargetComponent ) => {
10
15
hoistNonReactStatic ( TargetComponent , SourceComponent )
11
16
TargetComponent . displayName = `HotExported${ getComponentDisplayName (
@@ -16,7 +21,16 @@ const createHoc = (SourceComponent, TargetComponent) => {
16
21
17
22
const makeHotExport = ( sourceModule , getInstances ) => {
18
23
const updateInstances = ( ) =>
19
- setTimeout ( ( ) => getInstances ( ) . forEach ( inst => inst . forceUpdate ( ) ) )
24
+ setTimeout ( ( ) => {
25
+ if ( sourceModule . id ) {
26
+ try {
27
+ requireIndirect ( sourceModule . id )
28
+ } catch ( e ) {
29
+ // just swallow
30
+ }
31
+ }
32
+ getInstances ( ) . forEach ( inst => inst . forceUpdate ( ) )
33
+ } )
20
34
21
35
if ( sourceModule . hot ) {
22
36
// Mark as self-accepted for Webpack
You can’t perform that action at this time.
0 commit comments