Do not recommend default exports
EvgenyOrekhov opened this issue · comments
Reasons why default exports are evil:
- If default exported name doesn't match file name
- autocomplete doesn't work
- confusion increases
- If a module has both named exports and a default export
- confusion increases
- You can export the same thing as a named export and as a default export
- if you want to increase clutter and confusion, sure why not?
- If you used default export but then had to export another thing, you either have to use named exports together with a default export, or you have to change default export to a named export
- if you love refactoring...
- If declaration and default export are separate
- good luck connecting the dots
- Have to use
.default
in some cases (like with dynamicimport()
) - You can accidentally use a different name in each import site
- I don't blame you