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