umijs / babel-plugin-import

Modularly import plugin for babel.
3.15k stars 403 forks source link

feat: conditional expression supports comma operator #593

Open kayoch1n opened 2 years ago

kayoch1n commented 2 years ago
import { NewPage, OldPage } from "components"; // 使用按需加载的两个控件

let condition = 1, temp = '';
let Tag = condition? (temp = 'New', NewPage) : (temp = 'Old', OldPage); // 无法渲染

在条件表达式的 consequent 或者 alternate 部分使用了 comma opereator 的情况下,原来的代码仍然会导致渲染失败,类似这个issue

先前的这个 PR 对声明语句做了修复了,但是没有cover到其他表达式

kayoch1n commented 2 years ago

@sorrycc 打搅一下,有时间review一下不?