Skip to content

Cannot append Element node to non-array #12

@dessaya

Description

@dessaya

Hi, I'm trying to switch from transform-async-to-module-method to fast-async, and I bumped into this error. I reduced the code to this minimal example:

test.js:

export const A = '';

class B {
  async f() {
    await g();
  }
}

.babelrc:

{
  "presets": [
    "es2015",
    "stage-0"
  ],
  "plugins": [
    ["fast-async", {
      "runtimePattern": "main.js"
    }],
  ]
}

And it produces the following error:

Error: test.js: Cannot append Element node to non-array
    at Object.append (/home/diego/repos/brainiac-www/node_modules/nodent/lib/parser.js:87:23)
    at /home/diego/repos/brainiac-www/node_modules/nodent/lib/arboriculture.js:2190:34
    at Array.forEach (native)
    at /home/diego/repos/brainiac-www/node_modules/nodent/lib/arboriculture.js:2189:32
    at Object.treeWalker (/home/diego/repos/brainiac-www/node_modules/nodent/lib/parser.js:156:5)
    at hoistDeclarations (/home/diego/repos/brainiac-www/node_modules/nodent/lib/arboriculture.js:2136:16)
    at asyncTransforms (/home/diego/repos/brainiac-www/node_modules/nodent/lib/arboriculture.js:359:9)
    at asynchronize (/home/diego/repos/brainiac-www/node_modules/nodent/lib/arboriculture.js:352:9)
    at NodentCompiler.asynchronize (/home/diego/repos/brainiac-www/node_modules/nodent/lib/arboriculture.js:2657:20)
    at PluginPass.Program (/home/diego/repos/brainiac-www/node_modules/fast-async/plugin.js:36:14)

Is this a bug in fast-async, or perhaps something wrong in my code?

Thanks!

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