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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: @babel/runtime v7.18.0 regeneratorRuntime is not defined #14568

Closed
1 task
yanhcao opened this issue May 20, 2022 · 10 comments
Closed
1 task

[Bug]: @babel/runtime v7.18.0 regeneratorRuntime is not defined #14568

yanhcao opened this issue May 20, 2022 · 10 comments
Labels
area: downstream i: invalid outdated A closed issue/PR that is archived due to age. Recommended to make a new issue

Comments

@yanhcao
Copy link

yanhcao commented May 20, 2022

馃捇

  • Would you like to work on a fix?

How are you using Babel?

Other (Next.js, Gatsby, vue-cli, ...)

Input code

regeneratorRuntime.mark(...)
regeneratorRuntime.wrap(...)

Configuration file name

No response

Configuration

No response

Current and expected behavior

error: regeneratorRuntime is not defined

Environment

babel/runtime 7.18.0

Possible solution

No response

Additional context

No response

@babel-bot
Copy link
Collaborator

Hey @yanhcao! We really appreciate you taking the time to report an issue. The collaborators on this project attempt to help as many people as possible, but we're a limited number of volunteers, so it's possible this won't be addressed swiftly.

If you need any help, or just have general Babel or JavaScript questions, we have a vibrant Slack community that typically always has someone willing to help. You can sign-up here for an invite.

@nicolo-ribaudo
Copy link
Member

nicolo-ribaudo commented May 20, 2022

Could you share the source and the compiled version of the file where there is the error?

@yanhcao
Copy link
Author

yanhcao commented May 20, 2022

Could you share the source and the compiled version of the file where there is the error?

Sorry, its private project. A dependency of our project uses version 7.18.0 of @babel/runtime, when I build our project, I get an error "ReferenceError: regeneratorRuntime is not defined".

Then I found out that this version was released 13 hours ago. This pr #14538.
Is there any way to solve this problem please?
Thanks!

@nicolo-ribaudo
Copy link
Member

nicolo-ribaudo commented May 20, 2022

Step 1 of solving a problem is reproducing the problem 馃槢

Is that dependency public?


EDIT: A workaround is to install regenerator-runtime and import/require it as the first thing in your application, but in theory it shouldn't be necessary.

@nicolo-ribaudo
Copy link
Member

@yanhcao Can you share your Babel config and the version of the various Babel packages you are using?

@babel-bot
Copy link
Collaborator

Hi @yanhcao! This issue is missing some important information we'll need to be able to reproduce this issue.

Please understand that we receive a high volume of issues, and there are only a limited number of volunteers that help maintain this project. The easier it is for us to decipher an issue with the info provided, the more likely it is that we'll be able to help.

Please make sure you have the following information documented in this ticket:

  1. Your Babel configuration (typically from .babelrc or babel.config.js)
  2. The current (incorrect) behavior you're seeing
  3. The behavior you expect
  4. A short, self-contained example

Please provide either a link to the problem via the repl, or if the repl is insufficient, a new and minimal repository with instructions on how to build/replicate the issue.

@xqin
Copy link

xqin commented May 20, 2022

I had the same problem.

POC: https://github.com/xqin/regeneratorRuntime

You can reproduce the problem in the bad branch.

image

You can check the normal display of the page in the good branch.

image

The only difference is that I specified the version of @babel/runtime@7.17.9 in package.json.

image

@liuxingbaoyu
Copy link
Member

liuxingbaoyu commented May 20, 2022

@xqin
Nice reproducing code!
However I found that this seems to be a downstream issue.
node_modules\dva-core\dist\index.js uses regeneratorRuntime but does not contain implementation code.

@nicolo-ribaudo
Copy link
Member

Yup, it looks like dva-core has a broken compiler config, and it was accidentally working because of a transitive internal dependency of @babel/runtime that @babel/runtime doesn't need anymore.

The surprising thing is that their ESM build is correct, only the CommonJS one is not.

@nicolo-ribaudo
Copy link
Member

I reported this to the correct repository!

@nicolo-ribaudo nicolo-ribaudo closed this as not planned Won't fix, can't repro, duplicate, stale May 21, 2022
@github-actions github-actions bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Aug 21, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 21, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: downstream i: invalid outdated A closed issue/PR that is archived due to age. Recommended to make a new issue
Projects
None yet
Development

No branches or pull requests

5 participants