react-refresh-webpack-plugin
                                
                                 react-refresh-webpack-plugin copied to clipboard
                                
                                    react-refresh-webpack-plugin copied to clipboard
                            
                            
                            
                        Is there a way to disable this plugin on a specific entry?
I have mutiple entries, such as pageA and pageB. They render in different html. So I don't want to pageB get refresh when I was edit components used in pageA.
If they both run in the same Webpack instance there are no safe way to disable it because the runtime is injected globally and any HMR to any entry would propagete.
I have a similar issue where my browser extension has a full-page mode and also injects code into websites. Notably, there are two issues when code is injected into websites:
- Any call to localhost for hot reloading such as webpack-hot-middlewarefails (but I think nothing can be done about this because as you mentioned in your comment)
- If the website throws an error ReactRefreshWebpackPluginwill cause an error overlay to appear
I think point (2) should be addressable similar to what was done in #146 (do not inject the overlay for excluded entries). I tried to use the existing exclude argument to do this, but I couldn't manage to get it to give the desired result.
I think point (2) should be addressable similar to what was done in #146 (do not inject the overlay for excluded entries). I tried to use the existing
excludeargument to do this, but I couldn't manage to get it to give the desired result.
Hey, sorry I totally missed this comment.
In short, currently this is impossible due to how error overlays work: we listen on the global error and unhandled rejection events. React (nor do Webpack) does not expose "where" some error is originated, so it is complicated to filter out errors from "excluded" entries. In theory this could work, but would be very unreliable when things are transpired, mini died or uglified.
@pmmmwh Any news about it? Thanks!
@pmmmwh im also interested in this feature. I split some analytics code and when i have two webpack entries i get weird errors when updating a component which is just in the main app. For example
Uncaught TypeError: Cannot set properties of undefined (setting './src/components/Page/Header.tsx')
    at globalThis.webpackHotUpdate_snip_app (jsonp chunk loading:45:1)
    at app.fc9470d69894923203c7.hot-update.js:2:59
globalThis.webpackHotUpdate_snip_app @ jsonp chunk loading:45
(anonymous) @ app.fc9470d69894923203c7.hot-update.js:2
while with a single entry i do not have this. So if i could exclude one that would help. I didnt look that much deeper into why this is hapening.