feat: set react-refresh globals on Webpack require instead of global scope#102
Conversation
|
Very excited for this!! If you need any help testing, happy to lend a hand! |
|
About the point
That fixes #88: I modified the webpack-dev-server example this way: webpack.config.js: public/index.html: src/index1.js: src/App1.jsx: And similarly for index2.js and App2.jsx. But the behavior is, if I made a change in App1.jsx, the DOM is updated, but nothing happens if I modify App2.jsx. What does it mean "Multiple bundles included for the same page"? Is not this case? |
Sorry I cannot dig into this right now, this might be a regression somewhere. Can you try make both bundles share the same instance of React and React DOM and see if it works? |
|
Just add this to your Webpack config, it should work: module.exports = {
// ... Other stuff
optimization: {
runtimeChunk: 'single',
},
}; |
|
TypeError: |
|
You probably shouldn't apply |
This PR moves all react-refresh related globals to Webpack's require function instead of renderers' global scope.
This eliminates issues related to:
windowdefinedFixes #88.
Related to #36 and #79.
CC @sokra - if possible please take a look at this (possible issues/optimizations?)