Skip to content

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

@xaviergonz

Description

@xaviergonz

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions