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

Uncaught ReferenceError: regeneratorRuntime is not defined #3962

Closed
2 tasks done
markwoon opened this issue May 24, 2022 · 7 comments
Closed
2 tasks done

Uncaught ReferenceError: regeneratorRuntime is not defined #3962

markwoon opened this issue May 24, 2022 · 7 comments

Comments

@markwoon
Copy link

Describe the bug

babel-runtime@7.18.0 no longer includes regenerator-runtime dependency.

As a result, this happens:

    at eval (react-table.development.js?9781:272:1)
    at useAsyncDebounce (react-table.development.js?9781:350:6)
    at TextFilter (Text.js?0cad:62:54)
    at renderWithHooks (react-dom.development.js?f8c1:16175:1)
    at mountIndeterminateComponent (react-dom.development.js?f8c1:20913:1)
    at beginWork (react-dom.development.js?f8c1:22416:1)
    at HTMLUnknownElement.callCallback (react-dom.development.js?f8c1:4161:1)
    at Object.invokeGuardedCallbackDev (react-dom.development.js?f8c1:4210:1)
    at invokeGuardedCallback (react-dom.development.js?f8c1:4274:1)
    at beginWork$1 (react-dom.development.js?f8c1:27405:1)

I believe this is related to #3297.

According to babel/babel#14576 the fix is to add regenerator-runtime as a dependency.

Your minimal, reproducible example

Don't know how to reproduce babel usage in codesandbox

Steps to reproduce

  • Use babel with babel-runtime@7.18.0 to compile.
  • Use useAsyncDebounce
  • Get runtime error

Expected behavior

Expecting no runtime error.

How often does this bug happen?

Every time

Screenshots or Videos

No response

Platform

Windows Chrome

react-table version

7.8.0

TypeScript version

No response

Additional context

No response

Terms & Code of Conduct

  • I agree to follow this project's Code of Conduct
  • I understand that if my bug cannot be reliable reproduced in a debuggable environment, it will probably not be fixed and this issue may even be closed.
@nicolo-ribaudo
Copy link

@tannerlinsley You can see that regeneratorRuntime is used at line 272 of https://unpkg.com/browse/react-table@7.8.0/dist/react-table.development.js, but it's not defined anywhere. You can fix it in one of the following ways:

  • Add @babel/runtime to your Babel config, which loads the helpers from @babel/runtime (including regeneratorRuntime)
  • Manually add import "regenerator-runtime" in your source, which defines the regeneratorRuntime global
  • Update @babel/core and @babel/plugin-transform-regenerator to 7.18.0, so that the generated code doesn't rely on the regeneratorRuntime global anymore.

@tannerlinsley
Copy link
Collaborator

tannerlinsley commented May 25, 2022 via email

@tannerlinsley
Copy link
Collaborator

tannerlinsley commented May 25, 2022 via email

@nicolo-ribaudo
Copy link

nicolo-ribaudo commented May 25, 2022

We released 7.18.2 of @babel/runtime which should make it less likely to have this error (but it's a workaround, and we will remove it in Babel 8).

@nicolo-ribaudo
Copy link

Of the solutions above, the best thing would be to do (1) and (3).

Only (3) would be enough, but pairing it with (1) should result in a bundle size benefit for your users.

@tannerlinsley
Copy link
Collaborator

I'm open to a PR for this any time in the future.

@francis-vila
Copy link

francis-vila commented Apr 12, 2024

Despite this issue being closed, I saw this error, not in my own code, but in an example published on CodeSandbox to illustrate how to use react-table. Check it out here:

https://codesandbox.io/p/sandbox/github/tannerlinsley/react-table/tree/v7/examples/filtering

Added to that, in the package.json file, the version of React is specified as "^16.8.6". Are there any examples somewhere with more recent versions of react available for this module?

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

4 participants