我有一个名为的文件index.js
,我正在将其他模块导入其中,并使用命名导出将它们导出:
import { Card, Icon } from 'some-library';
import ButtonComponent from './Button';
export const Button = ButtonComponent;
我的问题是 - 如何some-library
在不更改名称的情况下从同一文件中导出那些命名的导入?
如果要导入命名导出并使用相同名称重新导出,请执行以下操作:
export { Card, Icon } from 'some-library';
如果要导入默认导出并使用某个特定名称重新导出它,请执行以下操作:
export { default as ButtonComponent } from './Button';
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句