繁体   English   中英

在ES6中导入/导出

[英]Import/ Exports in ES6

我有一个名为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';

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM