-
Notifications
You must be signed in to change notification settings - Fork 47.4k
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
Closure Compiler: wrong assignment order in instantiateReactComponent
#8894
Comments
Feel free to open a PR for review! @anmonteiro |
Thanks. Submitted in #8895 |
deas
pushed a commit
to deas/react
that referenced
this issue
Feb 6, 2017
gaearon
pushed a commit
that referenced
this issue
Feb 6, 2017
bvaughn
pushed a commit
that referenced
this issue
Mar 29, 2017
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When consuming React from source with the Google Closure Compiler, this bit of code isn't being run in the correct order.
It seems like the Google Closure Compiler transformation is changing the function to a
var
assignment. It messes up the behavior because the originalinstantiateReactComponent
function is hoisted. My thought is it's related to the fact that theinstantiateReactComponent
function is exported from that module.Anyway, this produces an error because the assignment to
ReactCompositeComponentWrapper.prototype
is now in the wrong order (assignment -> function definition, when we want definition -> assignment).This may also be related or the root cause of #8887.
The most straightforward solution is to bring the
Object.assign
call after the function is declared, which I've verified works correctly. I'm happy to submit a PR with the described approach.The text was updated successfully, but these errors were encountered: