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

Show a better message if React is not loaded #10406

Closed
gaearon opened this issue Aug 8, 2017 · 4 comments
Closed

Show a better message if React is not loaded #10406

gaearon opened this issue Aug 8, 2017 · 4 comments
Assignees

Comments

@gaearon
Copy link
Collaborator

gaearon commented Aug 8, 2017

Currently if React is not loaded, ReactDOM shows this:

screen shot 2017-08-08 at 3 36 52 pm

We should throw a nicer error message in the entry point I think.

@aweary
Copy link
Contributor

aweary commented Aug 8, 2017

@gaearon this throws in ReactGlobalSharedState, which is also used/re-exported by react-native. Should we include the invariant there and provide a renderer-agnostic error message, or try to include the error earlier in react-dom?

@gaearon
Copy link
Collaborator Author

gaearon commented Aug 8, 2017

I'm not sure. On the one hand throwing in that specific place would prevent this specific confusing error. On the other hand, there's no guarantee that it will throw there first. Renderer might use APIs on React object earlier.

@aweary
Copy link
Contributor

aweary commented Aug 11, 2017

Is there a way to determine in which order rollup will load modules, or explicitly include a snippet of code at the top of the bundle? If I add the invariant to the entry point for the bundle, it still fails with the cryptic error since the imported modules are hoisted to the top of the bundle.

@gaearon
Copy link
Collaborator Author

gaearon commented Aug 12, 2017

You can add a module like checkReact and then make it first import in the renderer. Then it's guaranteed to execute first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants