导出函数没有默认值

时间:2016-12-27 00:30:31

标签: javascript ecmascript-6

我有redux动作,这些动作在许多文件中都是小的简单功能。然后我将它们组合在一个文件中,如下所示。此文件名为moduleActions.js

import * as actions1 from './someActions';
import * as actions2 from './moreActions';
import * as actions3 from './someMoreActions';

const moduleActions = Object.assign({}, actions1, actions2, actions3);

export default moduleActions

如何在没有默认值的情况下导出moduleActions?上面的代码可以工作,但我的函数来自actions1,actions2等,它们位于默认对象中 - 见下文:

{
   default: {
     function1(),
     function2()
   }
}

我不想要那里的默认对象。我的函数应该在主对象中:

{
   function1(),
   function2()
}

我尝试在没有default的情况下导出moduleActions,但这给了我一个错误。

更新: 解决方案似乎是直接导出它们,甚至没有尝试组合它们。所以我的moduleActions.js文件现在看起来像这样:

export * from './someActions';
export * from './moreActions';
export * from './someMoreActions';

0 个答案:

没有答案