镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

ReferenceError: _asyncToGenerator2 is not defined #75

Closed as not planned
Closed as not planned

Description

@itwhat126

image
image
before serialize code:
image
the reason is "async"?
how to solve it

Activity

  1. okuryu commented on Mar 5, 2020

    @okuryu
    Collaborator

    Do you have any repro? I guess _asyncToGenerator2 is generated code by Babel not serialize-javascript. The serialize-javascript supports async functions as follows.

    > serialize(async function(){})
    'async function(){}'
    
  2. redonkulus commented on Oct 22, 2026

    @redonkulus
    Collaborator

    serialize-javascript emits async functions exactly as their source is written, and async functions and arrows round-trip correctly. The _asyncToGenerator2 reference comes from Babel's transpiled output, whose helper isn't available where the string is evaluated. Configure Babel not to transpile async functions in that code. Closing.

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions