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

[babel] use babel-runtime+transform-runtime to support async functions #304

Closed
wants to merge 1 commit into from
Closed

[babel] use babel-runtime+transform-runtime to support async functions #304

wants to merge 1 commit into from

Conversation

spalger
Copy link
Contributor

@spalger spalger commented Jan 12, 2018

Using async functions and targeting runtimes that don't support generators means that eui must depend on regenerator. Without it the test/syncify.js helper throws ReferenceError: regeneratorRuntime is not defined when installed as a node modules.

This pr includes the transform-runtime babel plugin which will rewrite access to the regeneratorRuntime global with calls to require("babel-runtime/regenerator"), which is now listed as a dependency of eui. This does add a fairly sizable dependency for one async function, but since Kibana is also using regenerator it should only get included in the bundles once.

Alternatively we can disallow async functions in eslint config and convert the syncify helper to use standard promises.

@pugnascotia
Copy link
Contributor

Why does EUI need async functions? I'm not against them, but if it's just to avoid a few promises, then it feels like overkill.

@chrisronline
Copy link
Contributor

We can just remove syncify from EUI if it’s the only use case and we don’t expect more.

@bevacqua
Copy link
Contributor

-1, would strive to keep EUI as lean as we can. It's only getting larger :)

@kimjoar
Copy link
Contributor

kimjoar commented Jan 15, 2018

PR for removing syncify: #306. syncify is no longer needed because of updates in Jest.

I'll close this. Let's just re-open if we want to reconsider async/await at some point.

@kimjoar kimjoar closed this Jan 15, 2018
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.

5 participants