I'm using vscode.
- When import via alias, ctrl + click
welcomejump to shims-vue.d.ts.
// router.config.ts
import welcome from '@pages/welcome/welcome.vue'
- When import via relative path, ctrl + click
welcomejump to shims-vue.d.ts, but clickwelcome.vuecan show the defination info.
// router.config.ts
import welcome from '../pages/welcome/welcome.vue'
- It is ok in .vue file
<script lang="ts">
import { defineComponent } from 'vue'
import welcome from '@pages/welcome/welcome.vue' // can jump to welcome.vue
export default defineComponent({
name: 'App',
})
</script>
Here is my tsconfig.json, is there anything goes wrong?
{
"compilerOptions": {
"target": "esnext",
"module": "esnext",
"moduleResolution": "node",
"strict": true,
"jsx": "preserve",
"sourceMap": true,
"resolveJsonModule": true,
"esModuleInterop": true,
"lib": ["esnext", "dom"],
"baseUrl": ".",
"paths": {
"@*": ["src/*"],
"@api*": ["src/api/*"],
"@components*": ["src/components/*"],
"@config*": ["src/config/*"],
"@enums*": ["src/enums/*"],
"@store*": ["src/store/*"],
"@types*": ["src/types/*"],
"@utils*": ["src/utils/*"],
"@pages*": ["src/pages/*"],
"@tests*": ["tests/*"]
}
},
"include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue"]
}