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 7 "useRuntimeModule" #65

Open
rkumorek opened this issue May 22, 2019 · 4 comments
Open

Babel 7 "useRuntimeModule" #65

rkumorek opened this issue May 22, 2019 · 4 comments

Comments

@rkumorek
Copy link

rkumorek commented May 22, 2019

Hey,

I am running into an issue when I write for...of loop with await. (example). I am transpiling to ES5 with babel and I believe I need nodent-runtime to have that code running.
When I add useRuntimeModule: true to babel config I get this error:
[dev:build] Error: This API has been removed. If you're looking for this functionality in Babel 7, you should import the '@babel/helper-module-imports' module and use the functions exposed from that module, such as 'addNamed' or 'addDefault'.

I've tried adding @babel/helper-module-imports but couldn't make it work, not sure exactly how should I use it ;(
Is there a way I can make it work with fast-async and babel 7?

Edit:
What I just found out is it runs those async functions in the loop but anything that's after the loop not invoked. :/

....
// everything runs before
for (const hook of this.hooks.before) {
    await hook(); // this run
}
await asyncFunction(); // this doesn't run
@rkumorek
Copy link
Author

rkumorek commented Jun 17, 2019

Thanks for response. I do have issue when using ky. It stops executing on this for...of loop https://github.com/sindresorhus/ky/blob/master/index.js#L226 and https://github.com/sindresorhus/ky/blob/master/index.js#L319

It is pretty much the same as our examples so I am not sure why would it fail. Any ideas?
Also after some more testing I had other async for...of loops working... except of ky loops.

// EDIT:

Oh my. I've been using fast-async 6.3. Upgraded to @7 and it works. Yay!
Thanks for help and for fast-async :) You can close the issue.

@rkumorek
Copy link
Author

Well, tried it again and after transpiling ky I still can't get it working on IE11 :( Guess I won't be able to use that package yet.

@patrick-mcdougle
Copy link

IE 11 doesn't have promises, so you might need to include a promise polyfill to get this to work in IE11.

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

No branches or pull requests

3 participants