kosko
kosko copied to clipboard
Feature request: ability to export an object from a component
Instead of:
export default [ componentName ]
Would be great to be able to do:
export default { componentName }
The use case is that the component can then be much easier consumed from another component by name.
E.g.:
// component-two.ts
import { componentOneService } from './component-one'
// now can do something with component's data
componentOneService.metadata.name
What do you think?
Can just maybe call Object.values()
on the component default export, if it's not array.
Instead of exporting all variables in default
, you can use named exports.
// component-one.js
export const componentOneService = new Service();
// component-two.js
import { componentOneService } from './component-one';
Right, of course. But would kosko then pick them up? Or do I need to still have the default export with an array?