I recently created a project using vue-cli3 and decided to incorporate TypeScript for added type safety.
Here is a snippet from my src/app.vue file:
<template>
<div id="app">
<hello-world msg="test"/>
</div>
</template>
<script lang="ts">
import { Component, Vue } from 'vue-property-decorator';
import HelloWorld from '@/components/HelloWorld';
@Component({
components: { HelloWorld },
})
export default class App extends Vue {}
</script>
Unfortunately, the compiler is returning an error stating "Cannot find module '@/components/HelloWorld'". However, I can confirm that the component HelloWorld does indeed exist.
Interestingly, if I either remove the lang="ts"
attribute or add the .vue
extension, everything compiles without any issues. In my tsconfig.json file, I have defined paths as follows:
"paths": {
"@/*": [ "src/*" ]
},
Could this be an issue with the tsconfig.json
configuration or something else causing this error?