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

regeneratorRuntime is not defined (--target node) #63

Closed
loqusion opened this issue Nov 10, 2021 · 3 comments · Fixed by #64
Closed

regeneratorRuntime is not defined (--target node) #63

loqusion opened this issue Nov 10, 2021 · 3 comments · Fixed by #64
Labels
area:bug Something isn't working

Comments

@loqusion
Copy link

loqusion commented Nov 10, 2021

When I try to bundle a JavaScript library that uses async functions and then use that library, I get ReferenceError: regeneratorRuntime is not defined, even when using --target node.

I found that the issue is resolved by adding { target: { node: "16" } } to the options of babel-preset-o in createInputConfig in src/rollup-config.ts, since instead of the async/await keywords being transformed to use regeneratorRuntime, they are just passed through to the output as is. Though I'm not sure exactly what value node should be instead of "16". Also, perhaps esmodules: true should be also added to target like it was before? (see below)

targets: {
node: '4',
esmodules: true,
},

@huozhi huozhi added the area:bug Something isn't working label Nov 11, 2021
@huozhi
Copy link
Owner

huozhi commented Nov 11, 2021

Thanks for reporting, regenerator definition is missing for javascript usage with babel but not missing in typescript side. Very good catch

@huozhi
Copy link
Owner

huozhi commented Nov 11, 2021

@Flandre-X Can you try the new version 1.7.3 to see if it solves your problem?

@loqusion
Copy link
Author

@huozhi Yup it works, thanks for the fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants