-
Notifications
You must be signed in to change notification settings - Fork 194
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The webpack parts look good to me
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:
window
definedFixes #88.
Related to #36 and #79.
CC @sokra - if possible please take a look at this (possible issues/optimizations?)