Home  >  Q&A  >  body text

Unused definition: "HelloWorld"

App.vue file

<template lang="pug">
div
  hello-world
</template>
<script setup lang="ts">
import HelloWorld from "./components/HelloWorld.vue";
</script>

HelloWorld.vue file

<template lang="pug">
div
  h1 {{ msg }}
</template>

<script setup lang="ts">
import { ref } from "vue";

const msg = ref<string>("Hello World!!!");
</script>

What is the problem and how to solve it? Encountered this issue when using typescript, composition API and pug template together in vue3. Concerned about how to import a component using the composition API and use it in a pug template?

P粉106711425P粉106711425204 days ago403

reply all(1)I'll reply

  • P粉762447363

    P粉7624473632024-03-30 11:27:24

    I'm pretty sure the problem comes from pre-installing typescript. Removing typescript as a scripting language should do the trick: