I have setup Nuxt with TypeScript using the instructions from https://typescript.nuxt.org. The transition was pretty seamless and ok, except that I can't get rid of this error that nuxt:typescript
"Cannot find module", which obviously is a false-positive.
My imports look like this:
import InputField from '@/components/InputField.vue'
I have tried with ~/
and without the .vue
extension. Nothing works.
My tsconfig.json
looks like this:
{
"compilerOptions": {
"target": "esnext",
"module": "esnext",
"moduleResolution": "node",
"lib": ["esnext", "esnext.asynciterable", "dom"],
"esModuleInterop": true,
"allowJs": true,
"sourceMap": true,
"strict": true,
"noEmit": true,
"baseUrl": ".",
"paths": {
"~/*": ["src/*"],
"~*": ["src/*"],
"@/*": ["src/*"]
},
"types": ["@types/node", "@nuxt/types"]
},
"exclude": ["node_modules"]
}
And I have this object in my nuxt.config.js
:
typescript: {
typeCheck: {
eslint: true,
vue: true
}
}
.vue
files, and not.ts
file imports: github.com/nuxt/typescript/issues/153