How come I can write
export { function1, function2 };
But I can't write
const funcs = { function1, function2 };
export funcs;
Isn't it semantically the same thing?
Is there any way to export all properties from an object without listing them all one by one? I want to be able to import the module as a whole (i.e. import Utils from './utils'
) and as individual functions (import { function1 } from './util'
), but it won't let me use my default export object for normal export:
const Util = {
...
};
export ???; // <- what do I put here? do I really have to list every field in Util?
export default Util;