benjamn / benjamn/recast

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

Open
#995 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
5.3k
Forks
363
Avg merge
3d 8h
Merged PRs (30d)
3

Description

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

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

![image](https://user-images.githubusercontent.com/56751617/138421976-68d14759-b627-43ae-bd4f-a23c9a625583.png)

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the reported parse call with recast ^0.20.5 and verify whether the import() example is valid JavaScript syntax. Then inspect the parser entry point used by recast and define done as correctly parsing a valid dynamic import without an AST error, with the expected behavior covered by a regression test.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.