Skip to content
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

Completely isolate the error overlay script from the main app #3120

Closed
gaearon opened this issue Sep 13, 2017 · 3 comments
Closed

Completely isolate the error overlay script from the main app #3120

gaearon opened this issue Sep 13, 2017 · 3 comments

Comments

@gaearon
Copy link
Contributor

gaearon commented Sep 13, 2017

I’m worried that if we add duplicate React detection (e.g. facebook/react-devtools#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?

@gaearon
Copy link
Contributor Author

gaearon commented Sep 13, 2017

@tharakawj Thoughts?

@tharakawj
Copy link
Contributor

tharakawj commented Sep 15, 2017

Technically this sounds possible though we have to figure it out how to do it. Also, I'm not sure parsing React code each time when we create a new iframe, will have any performance impact. Let me try some experiments around this and get back to you.

@tharakawj
Copy link
Contributor

tharakawj commented Sep 17, 2017

Created a PR for this! #3142
It was straightforward than I thought. And it works pretty fast as well. 😀
@gaearon I'd like to hear your feedback.

@lock lock bot locked and limited conversation to collaborators Jan 21, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants