Description
What problem does this feature solve?
I know that it is subjective to some extend, but there are proponents of named exports and I am one of them:
- Default exporting objects is usually an anti-pattern
- Why we have banned default exports and you should do the same
Most important aspect for me is the ability to refactor in less time, when dealing with named exports.
People who don't care about the consistence in code or just by a mistake might import giving a different name every time or even once.
Then, the inconsistency will increase the complexity.
Hence, ALLOW NAMED EXPORTS, so there would be an opportunity to name all of the Vue components and prevent the possibility of people, importing same module giving a different name (obviously, there would still be export {module as anotherName} from './path'
), but no typos and still better organization of code.
What does the proposed API look like?
Don't require having a default export.
Export .vue components as:
// App.vue
export const app = {}
// instead of (without prohibiting default exporting for backwards compatibility)
export default {}