In a TypeScript CLI generated project (no Babel) the following __import__ in "App.vue" reports a "not a module" error!
// File: App.vue
<script lang="ts">
import HelloWorld from "./components/HelloWorld/HelloWorld.vue";
__Error: "HelloWorld.vue is not a module"__
Project builds and runs fine, but Vetur fails to determine the file is a module.
The file "__HelloWorld.vue__" file contains.
<template>
<div>
<h1>Hello World!</h1>
</div>
</template>
<script lang="ts" src="./HelloWorld.ts" />
<style scoped lang="stylus" src="./HelloWorld.stylus" />

I have same issue when start a new project nuxtjs with typescript !
Demo: https://prnt.sc/rpvv4p
same here. Does anyone have a workaround for this issue?
Problem in nestjs when creating a new project.
Probably doesn't detect
<template>
<svg class="NuxtLogo" width="245" height="180" viewBox="0 0 452 342" xmlns="http://www.w3.org/2000/svg">
<g fill="none" fill-rule="evenodd">
<path
d="M139 330l-1-2c-2-4-2-8-1-13H29L189 31l67 121 22-16-67-121c-1-2-9-14-22-14-6 0-15 2-22 15L5 303c-1 3-8 16-2 27 4 6 10 12 24 12h136c-14 0-21-6-24-12z"
fill="#00C58E"
/>
<path
d="M447 304L317 70c-2-2-9-15-22-15-6 0-15 3-22 15l-17 28v54l39-67 129 230h-49a23 23 0 0 1-2 14l-1 1c-6 11-21 12-23 12h76c3 0 17-1 24-12 3-5 5-14-2-26z"
fill="#108775"
/>
<path
d="M376 330v-1l1-2c1-4 2-8 1-12l-4-12-102-178-15-27h-1l-15 27-102 178-4 12a24 24 0 0 0 2 15c4 6 10 12 24 12h190c3 0 18-1 25-12zM256 152l93 163H163l93-163z"
fill="#2F495E"
fill-rule="nonzero"
/>
</g>
</svg>
</template>
<style>
.NuxtLogo {
animation: 1s appear;
margin: auto;
}
@keyframes appear {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}
</style>
Temporary solution.
Add a ruler before error this comment
// @ts-ignore
Is there any info available about any plans or progress towards a solution to this problem?
It happens for vue files with or without script tag. In my case it's a script tag with lang set to ts and src set to the external ts file.
Known workarounds, next to the suggested // @ts-ignore comment:
Vue files without script tag
<script>export default{}</script>Vue files with script tag with src attribute set to external script file (ts/js)
<script lang="ts">
import component from './component';
export default component;
</script>
https://github.com/vuejs/vetur/issues/762
The problem disappears when you run the project in a direct folder vue / nuxt etc..
For example: Tree Folder
- index.html
src < --- (main folder eg nuxt, vue-cli )
- assets
- components
- dist
- ...
...
Open Vscode in main folder eg nuxt, vue-cli
Maybe it's just because the component doesn't have a default export
Similar question
Duplicate of #1187, which will be fixed soon.
Most helpful comment
Temporary solution.
Add a ruler before error this comment