9

JavaScript: Default exports vs. named exports

Who gives a fuck, honestly? I used to think there was merit to one over the other, but I'm running out of steam to have these silly debates.

Comments
  • 2
    Convention. Decide, then follow, and enforce.
    Also spaces vs tabs.
  • 2
    @webpackconfig my god you did choose a nickname
  • 2
    When in doubt - named exports ftw. They do better with autocomplete too. Default exports are inherently a bit limited and are only there to give a false sense of freedom.
  • 0
    Named, all the way. From my experience, it’s better to spread scope across files not by a code property, but by a business one. Files shouldn’t be “frontend” and “backend”, they should be “home screen” and “cart”, with those files containing everything needed for their respective scopes.
    That said, every file will obviously contain different independent parts of the application logic, so it’s best to use named exports.
Add Comment