Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Component Name and Named Exports Idea for <script setup> #5633

Closed
joezimjs opened this issue Mar 28, 2022 · 2 comments
Closed

Component Name and Named Exports Idea for <script setup> #5633

joezimjs opened this issue Mar 28, 2022 · 2 comments

Comments

@joezimjs
Copy link

I saw some people on Twitter that noted Vue's general usage of default exports for all components. Some people, and myself to an extent, think that named exports are a better practice, but I love <script setup> too much to give it up for named exports.

So I was thinking about enhancing <script setup> with an additional attribute: name. We can use it to specify the name it'll be exported as, as well as potentially the component's name (so it doesn't need to be computed based on the file name) for recursive use of the component.

E.g.

<script setup name="MyComponent"></script>

Would compile to

export const MyComponent = {
    name: "MyComponent" // I'm not 100% set on this part
}

I'm not sure how you would handle someone using a separate script tag to add inheritAttrs or anything, but I bet you can make it work.

@edison1105
Copy link
Member

duplicate of #5218

@posva posva closed this as completed Mar 28, 2022
@joezimjs
Copy link
Author

This is not a duplicate entirely. That issue was for component name and I'm asking for the ability to name the export rather than using a default export.

@github-actions github-actions bot locked and limited conversation to collaborators Oct 1, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants