Skip to content

Allow named exports for .vue components. Don't require having a default export #1234

Closed
@o-alexandrov

Description

@o-alexandrov

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:

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 {}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions