Issue
Who can help me? I have this tsconfig.json
:
{
"compilerOptions": {
"target": "esnext",
"module": "esnext",
"moduleResolution": "node",
"strict": true,
"jsx": "preserve",
"esModuleInterop": true,
"skipLibCheck": true,
"noImplicitAny": false,
"allowJs": true,
"forceConsistentCasingInFileNames": true,
"baseUrl": ".",
"paths": {
"@/*": ["./backend/app/*"]
},
"types": ["node"]
},
"include": ["backend/app/**/*.ts", "backend/app/**/*.vue"],
"exclude": ["node_modules"]
}
And inside my main.ts
file which lives inside backend/app/main.ts
I am importing this import app from './app.vue';
located in backend/app/app.vue
and this file only contains:
<template>
<router-view/>
</template>
And when I compile, TS throws this error
TS2307: Cannot find module './app.vue' or its corresponding type declarations
I also use webpack and I provided ts-loader
:
{
test: /\.ts?$/u,
loader: 'ts-loader',
exclude: /node_modules/u,
options: {
appendTsSuffixTo: [/\.vue$/u],
},
},
Project compiles correctly and works, but TS throws this.
Solution
Fix is to declare shims-vue.d.ts
declare module '*.vue' {
import Vue from 'vue';
export default Vue;
}
Answered By - Spagheeti
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.