esxjs / to-esx

Converts JSX and `React.createElement` into ESX

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unexpected token at dynamic import

irudoy opened this issue · comments

Acorn fails at something like this:

const Component = lazy(() => import("./Component"));
SyntaxError: Unexpected token (20:10)
    at Object.pp$4.raise (/.../to-esx/node_modules/acorn/dist/acorn.js:2825:15)
    at Object.pp.unexpected (/.../to-esx/node_modules/acorn/dist/acorn.js:689:10)
    at Object.pp.expect (/.../to-esx/node_modules/acorn/dist/acorn.js:683:28)
    at Object.pp$1.parseImportSpecifiers (/.../to-esx/node_modules/acorn/dist/acorn.js:1580:10)
    at Object.pp$1.parseImport (/.../to-esx/node_modules/acorn/dist/acorn.js:1551:30)
    at Object.pp$1.parseStatement (/.../to-esx/node_modules/acorn/dist/acorn.js:863:49)
    at Object.pp$1.parseBlock (/.../to-esx/node_modules/acorn/dist/acorn.js:1161:23)
    at Object.pp$1.parseStatement (/.../to-esx/node_modules/acorn/dist/acorn.js:845:36)
    at Object.pp$1.parseIfStatement (/.../to-esx/node_modules/acorn/dist/acorn.js:990:28)
    at Object.pp$1.parseStatement (/.../to-esx/node_modules/acorn/dist/acorn.js:834:33)
    at Object.pp$1.parseBlock (/.../to-esx/node_modules/acorn/dist/acorn.js:1161:23)
    at Object.pp$3.parseFunctionBody (/.../to-esx/node_modules/acorn/dist/acorn.js:2671:24)
    at Object.pp$3.parseArrowExpression (/.../to-esx/node_modules/acorn/dist/acorn.js:2634:10)
    at Object.pp$3.parseExprAtom (/.../to-esx/node_modules/acorn/dist/acorn.js:2203:25)
    at Object.parseExprAtom (/.../acorn-jsx/index.js:398:22)
    at Object.pp$3.parseExprSubscripts (/.../to-esx/node_modules/acorn/dist/acorn.js:2089:21)
    at Object.pp$3.parseMaybeUnary (/.../to-esx/node_modules/acorn/dist/acorn.js:2066:19)
    at Object.pp$3.parseExprOps (/.../to-esx/node_modules/acorn/dist/acorn.js:2010:21)
    at Object.pp$3.parseMaybeConditional (/.../to-esx/node_modules/acorn/dist/acorn.js:1993:21)
    at Object.pp$3.parseMaybeAssign (/.../to-esx/node_modules/acorn/dist/acorn.js:1968:21)
    at Object.pp$1.parseVar (/.../to-esx/node_modules/acorn/dist/acorn.js:1228:26)
    at Object.pp$1.parseVarStatement (/.../to-esx/node_modules/acorn/dist/acorn.js:1092:10)

{
  pos: 1665,
  loc: Position { line: 20, column: 10 },
  raisedAt: 1666
}

Maybe we should use acorn-dynamic-import?

Seems like has been resolved in 1085a0e