Open yunqiangwu opened 2 years ago
babel config:
{ "plugins": [ ["@babel/plugin-transform-typescript", { "legacy": true }], [ "babel-plugin-import", { "libraryName": "antd", "libraryDirectory": "lib", "style": true }, "c7n-pro" ], ["@babel/plugin-proposal-decorators", { "legacy": true }] ] }
source js:
import { observer } from 'mobx-react'; import { Button } from 'antd'; @observer export default class TestAaa extends RichText { hello() { console.log({ Button: (Button as any) }); console.log({ Button, }); const MyButton = { ...Button }; } }
babel transpiled:
import "antd/lib/button/style"; import _Button from "antd/lib/button"; var _class; import { observer } from 'mobx-react'; let TestAaa = observer(_class = class TestAaa extends RichText { hello() { console.log({ Button: Button }); console.log({ Button: _Button }); const MyButton = { ...Button }; } }) || _class; export { TestAaa as default };
第 11 行代码应该是 _Button 才对, 这里却变成了 Button
相关依赖版本:
bug online demo (重现的在线链接): bug online demo
[ "babel-plugin-import", { "libraryName": "antd", "libraryDirectory": "lib", "style": true }, "c7n-pro" ]
中 "c7n-pro" 这个参数值 代表什么意思的呢?
babel config:
source js:
babel transpiled:
第 11 行代码应该是 _Button 才对, 这里却变成了 Button
相关依赖版本:
bug online demo (重现的在线链接): bug online demo