When you create a component with reactivity the component will have a field __name that basically boils down to filename.match(/([^/\\]+)\.\w+$/ (relevant source from vuejs/vue).
But I noticed that if the <script setup> is empty or missing then the __name field is absent.
However, the other meta fields __file are always present.
Understanding this is entirely internal behaviour, the inconsistency is annoying and leaves a gap that could otherwise still be useful to developers (specifically devtools and other meta tools).
As immediate remedy the __name field could be set whereever __file is provided already.
[X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
[X] Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to vuejs/core instead.
Related plugins
[X] plugin-vue
[ ] plugin-vue-jsx
Describe the bug
When you create a component with reactivity the component will have a field
__name
that basically boils down tofilename.match(/([^/\\]+)\.\w+$/
(relevant source from vuejs/vue).But I noticed that if the
<script setup>
is empty or missing then the__name
field is absent. However, the other meta fields__file
are always present.Understanding this is entirely internal behaviour, the inconsistency is annoying and leaves a gap that could otherwise still be useful to developers (specifically devtools and other meta tools).
As immediate remedy the
__name
field could be set whereever__file
is provided already.Reproduction
https://stackblitz.com/edit/vitejs-vite-6zx8jk?file=src%2FApp.vue
Steps to reproduce
<script setup>
section, and no<script>
section.__name
and__file
fields of the component.__file
is provided, but__name
is not.System Info
Used Package Manager
npm
Logs
No response
Validations