Completely isolate the error overlay script from the main app
Created by: gaearon
I’m worried that if we add duplicate React detection (e.g. https://github.com/facebook/react-devtools/pull/714), it will start firing in CRA development mode because react-error-overlay
might ship with its own copy of React (e.g. if the app user deletes React but then adds an incompatible version). I’d like to avoid warning in such cases because it is intentional, and the iframe is meant to be completely opaque to the app developer.
I wonder if we can package the error overlay code in a way that it bundles React (rather than just importing it via CommonJS) and executes it in the context of the iframe (e.g. via iframeWindow.eval
). Then DevTools shouldn’t “see“ React there.
Does this make any sense?