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 #684

Closed
poteirard opened this issue Apr 15, 2020 · 2 comments · Fixed by #795
Closed

regeneratorRuntime is not defined #684

poteirard opened this issue Apr 15, 2020 · 2 comments · Fixed by #795
Labels
kind: support Asking for support with something or a specific use case problem: removed issue template OP removed the issue template without good cause solution: duplicate This issue or pull request already exists solution: workaround available There is a workaround available for this issue

Comments

@poteirard
Copy link

poteirard commented Apr 15, 2020

Hello,

I have some libraries that are meant to be used in node and web environments.

I run tsdx build, then in the consumer of the library I run tsc and then node dist/index.js then I get an error:

ReferenceError: regeneratorRuntime is not defined
[server]     at Object.<anonymous> (/Users/.../node_modules/myPakcage/random-lib/dist/random-lib.cjs.development.js:214:28)

Am I missing something?

Thank you!

tsdx -v 0.13.1

@poteirard poteirard changed the title Compile for web and node Compile for web and node: regeneratorRuntime is not defined Apr 15, 2020
@agilgur5 agilgur5 changed the title Compile for web and node: regeneratorRuntime is not defined regeneratorRuntime is not defined Apr 16, 2020
@agilgur5 agilgur5 added the problem: removed issue template OP removed the issue template without good cause label Apr 16, 2020
@agilgur5
Copy link
Collaborator

agilgur5 commented Apr 16, 2020

Please don't remove the issue template. It is there for a reason.
Please do search issues before posting duplicates -- this is a duplicate of #547 and #169

You're using generators, which require a polyfill (i.e. regeneratorRuntime). You need to decide how you're going to polyfill it and then do so.
That's unrelated to and not caused by web vs node usage. But potentially worthy to note, those are two separate target platforms and TSDX has the --target flag as such (which configures things like preset-env's options for node builds).

@agilgur5 agilgur5 added solution: duplicate This issue or pull request already exists kind: support Asking for support with something or a specific use case labels Apr 16, 2020
@agilgur5 agilgur5 added the solution: workaround available There is a workaround available for this issue label Aug 23, 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: support Asking for support with something or a specific use case problem: removed issue template OP removed the issue template without good cause solution: duplicate This issue or pull request already exists 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