benjamn / recast

JavaScript syntax tree transformer, nondestructive pretty-printer, and automatic source map generator
MIT License
5.01k stars 350 forks source link

使用import() 时,解析出错; #995

Open wyw-s opened 3 years ago

wyw-s commented 3 years ago

代码中有用到 import() 语句。但是转化为AST时报错; "recast": "^0.20.5" ` const { parse } = require('recast');

const ast = parse('import(./a.js)'); `

image

hbrls commented 4 months ago

这个就是少写了双引号吧...

const ast = parse('import("./a.js")');
                          ^      ^