defineOptions
<script setup> is a shortcut: it holds only what the template needs. That
leaves nowhere to set the component's own options, such as its name.
defineOptions fills that gap. It takes the options object you would have
written in a plain <script> block and applies it to the component:
<script setup>
defineOptions({ name: 'GreetingCard' });
</script>
The name option labels the component. Vue uses it in warnings and in the
devtools component tree, so a named component is easier to find than an
anonymous one. You can set any component option this way, not only name.
Options set here behave exactly as if you had written them in a separate
<script> block alongside <script setup>.
defineOptions is a compiler macro, so you never import it. It is available in
Vue 3.3 and later. The Test reads the component's name and checks it matches
the one you set.
Challenge
The component has no name. Name it: export an App component from App.vue
that sets the component's name option to GreetingCard with defineOptions.
The Test reads the component's name and expects GreetingCard. The starter
sets no options, so the name is empty and the Test fails. Add the defineOptions
call.