index.js
import { Human } from 'test';
export default Human;
我正在从 test
导入命名导出 Human
。我正在将 Human 作为 default
从 index.js
导出,以允许其他人从 index.js
而不是 test
导入 Human >.
例如:
import Human from 'index';
如何将 index.js
中的上述 2 条语句合并为一行?
最佳答案
使用作为
:
export { Human as default } from "test";
这会导入 Human
,将其更改为 default
,然后导出。
关于javascript - 如何在一行中默认导出命名导入?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57422772/