question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Bug] regeneratorRuntime is not defined with useAsyncTask

See original GitHub issue

I want to use useAsyncTask like so:

const myAsyncTask = useAsyncTask(() => {
    return functionThatReturnsPromiseWithMyData('this is an argument')
})

but when I try to run this, I get Uncaught (in promise) ReferenceError: regeneratorRuntime is not defined

I am using vue 3.1.4, vite 2.4.1, and vue-concurrency 2.1.2

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
MartinMalindacommented, Sep 23, 2021

Caused by https://github.com/developit/microbundle/issues/708. I tried to update microbundle but ran into different errors afterwards. I’ll give it another try when I have more time.

0reactions
Hawxycommented, Jun 29, 2022

With Vue 3 & Vite I’ve been using the temporary fix of :

  1. npm install regenerator-runtime
  2. Adding import 'regenerator-runtime/runtime' at the top of main.ts

If you’re using webpack/babel (ie Vue 2), you can also import it directly without the extra package: import '@babel/runtime/regenerator';

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to fix regeneratorRuntime is not defined?
I have ran into a problem, the error is regeneratorRuntime is not defined while working with React and Parcel bundler.
Read more >
Babel 6 regeneratorRuntime is not defined
This error is caused when async/await functions are used without the proper Babel plugins. As of March ...
Read more >
Regeneratorruntime Is Not Defined In React 17, Webpack ...
I cited an example based on react-hooks-async which has a error: undefined }; return task; }; export const useAsyncTask (func) The one-way data...
Read more >
Parcel, how to fix the `regeneratorRuntime is not defined` ...
Parcel, how to fix the `regeneratorRuntime is not defined` error ... avoid this error you need to also load the regenerator-runtime runtime.
Read more >
Uncaught ReferenceError: regeneratorRuntime is not defined
Uncaught ReferenceError : regeneratorRuntime is not defined – Two Solutions. Trying to use async/await in my React app gave me this error ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found