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

[Fix] Register module binding #68

Merged
merged 1 commit into from
Dec 28, 2019
Merged

[Fix] Register module binding #68

merged 1 commit into from
Dec 28, 2019

Conversation

Timer
Copy link
Contributor

@Timer Timer commented Dec 28, 2019

This pull requests registers the React import added by this plugin. This is necessary as Babel does not automatically detect new bindings.

As a result, two or more Babel plugins can implement this behavior and all rely on path.scope.hasBinding('React') to prevent duplication.

I eliminated the destructuring assignment as unshiftContainer relies on this (path).

Also added a test that ensures the binding is present.


Fixes #50

@Timer Timer mentioned this pull request Dec 28, 2019
@Timer Timer changed the title Register Module Binding [Fix] Register Module Binding Dec 28, 2019
@Timer Timer changed the title [Fix] Register Module Binding [Fix] Register module binding Dec 28, 2019
Copy link
Collaborator

@ljharb ljharb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this looks great

@ljharb ljharb merged commit a68d320 into airbnb:master Dec 28, 2019
@Timer Timer deleted the hotfix/register-binding branch December 28, 2019 23:46
@adamsoffer
Copy link

woohoo! Thanks guys :)

@adamsoffer
Copy link

@ljharb cool if we publish this hotfix to npm?

@adamsoffer adamsoffer mentioned this pull request Jan 18, 2020
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

Successfully merging this pull request may close these issues.

NextJS 7 compatibility
3 participants