从index.js导出名称空间 [英] namespace export from index.js
本文介绍了从index.js导出名称空间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的 index.js
会导出以下内容:
export * from 'fileOne';
export * from 'fileTwo';
export * from 'fileThree';
我想为file4中的内容命名空间,像这样:
I want to name space the stuff from file4, something like this:
export { default as mockStuff } from 'file4';
OR
export { * as mockStuff } from 'file4'
我什至尝试了(以及各种组合):
I've even tried (and various combinations):
import * as mockStuff from 'file4';
export mockStuff
我该怎么做?
推荐答案
我认为这是您要寻找的:
I think this is what you're looking for:
import * as mockStuff from "./file4";
export { mockStuff };
这篇关于从index.js导出名称空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文