Skip to content

[Bug] regeneratorRuntime is not defined with useAsyncTask #51

Open

Description

@dospunk

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

Activity

  1. MartinMalinda commented on Jul 21, 2021

    @MartinMalinda
    Owner
  2. nickngqs commented on Aug 6, 2021

    @nickngqs

    I'm getting this bug as well, with usePipeTask.

    vite 2.1.3, vue 3.2.0, vue-concurrency 2.1.2

  3. eLoyyyyy commented on Aug 20, 2021

    @eLoyyyyy

    same behavior with usePipeTask.

    vue@2.6.12
    nuxt@2.15.6
    vue-concurrency@2.1.2
    
  4. MartinMalinda commented on Sep 23, 2021

    @MartinMalinda
    Owner

    Caused by developit/microbundle#708. I tried to update microbundle but ran into different errors afterwards. I'll give it another try when I have more time.

  5. torleifhalseth commented on Mar 15, 2022

    @torleifhalseth

    Any updates on this @MartinMalinda?

  6. amrap030 commented on Apr 19, 2022

    @amrap030

    I have this error too in a vue 3 project. I also tried pasting your example from the test as shown below and still have the same error:

    const addTask = useTask(function* (signal, a: number, b: number) {
      return yield a + b;
    });
    const add10Task = useTask(function* (signal, a: number) {
      return yield a + 10;
    });
    const add20Task = useTask(function* (signal, a: number) {
      return yield a + 20;
    });
    const pipeTask = useSequentialTask(addTask, add10Task, add20Task);

    When i remove the last line, I get no errors. This makes the library unfortunately unusable for me.

  7. Hawxy commented on Jun 29, 2022

    @Hawxy
    Contributor

    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';

  8. MartinMalinda commented on Feb 6, 2024

    @MartinMalinda
    Owner

    Since vite is used to bundle the lib now, there's a good chance it's fixed in 5.0. Can anyone confirm?

  9. Hawxy commented on Feb 7, 2024

    @Hawxy
    Contributor

    Yes this is fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions