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

use babel-plugin-transform-runtime for generator function support #169

Closed
xaviergonz opened this issue Jul 28, 2019 · 1 comment · Fixed by #795
Closed

use babel-plugin-transform-runtime for generator function support #169

xaviergonz opened this issue Jul 28, 2019 · 1 comment · Fixed by #795
Labels
kind: feature New feature or request solution: workaround available There is a workaround available for this issue

Comments

@xaviergonz
Copy link

Current Behavior

Right now, when using generator functions, a global import of regenerator-runtime is required, which means that either the library consuming project has to import it itself, or that the library has to import it (which can cause problems due to different versions of the regenerator-runtime being possibly imported.

Desired Behavior

The library should use its own version of the regenerator-runtime without polluting the global namespace.

Suggested Solution

https://babeljs.io/docs/en/babel-plugin-transform-runtime

Using that plugin with regenerator set to true + including regenerator-runtime as dependency should ensure that the regenerator runtime is not using a global namespace and can be imported by the own library without problems.

Who does this impact? Who is this for?

Libraries that make use of generator functions.

@xaviergonz xaviergonz changed the title use babel-plugin-transform-runtime use babel-plugin-transform-runtime for generator function support Jul 28, 2019
@agilgur5 agilgur5 added the solution: workaround available There is a workaround available for this issue label Aug 25, 2020
@agilgur5 agilgur5 added the kind: feature New feature or request label Sep 20, 2020
@agilgur5
Copy link
Collaborator

agilgur5 commented Sep 20, 2020

Automatic pure polyfilling of generators with babel-plugin-polyfill-regenerator for targets that need a polyfill has been added in #795 and will be released in v0.14.0 soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: feature New feature or request solution: workaround available There is a workaround available for this issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants