Add an javascript index file in component
florentferry opened this issue · comments
In order to use import 'button';
instead of import 'button/button';
, we should add an index.js
in component folder which only do import of button.js
.
I'm not sure about this.
It allows for a cleaner import
syntax, but we have to have an (nearly empty) index.js
in each component. We already have about 4-5 files in most components, I think we have to make sure we don't add too much files.
Maybe we could name the JS file index.js
instead of button.js
(for a component is named button
) instead?
But then the issue is that we have a lot of files with the same name (index.js
) and it's a mess when you have a lot of them opened in your editor.
When using collection of components packaged into a npm module, its more concise to just import component with the name of the component instead of component_name/component_name
. But we can delayed the feature, and discuss about it.
Yes, I understand the idea, but I think the drawback (adding an index.js
file to each component) is bigger than the advantage (being able to import component_name
instead of component_name
).
Isn't there another way to achieve this?
I am closing this issue, feel free to reopen to discuss more about usage of an index.js
file instead of explicit naming.