Closed mlmmn closed 10 months ago
You're right. I think we can get away with removing the filename check completely. Any error message with "hydration" or "hydrating" should be good enough of a condition IMO. Would you be interested in putting up a PR? Should be a one-liner 😃
@samijaber just opened a PR :v:
hydration-overlay-initializer.js
relies on presence ofreact-dom
string in event filename, namelyconst isReactDomError = event.filename.includes("react-dom");
. This won't work when chunk that contains ReactDOM lib is renamed. Below is an extract from a real world Webpack config:This config puts listed dependencies inside
vendor.chunk.js
module which obviously does not satisfy aforementioned condition. To mitigate this issue within workbase that I'm working on, I copied the contents ofhydration-overlay-initializer.js
script and modified it like so:Then this module is simply imported within bootstrap code. I believe this is not an ideal solution, but I hope it helps to shed some light on the issue as well as iterating to find a decent solution :v: