Can not jump to defination when import .vue in ts file via alias,instead jump to shims-vue.d.ts

Viewed 215

I'm using vscode.

  1. When import via alias, ctrl + click welcome jump to shims-vue.d.ts.
// router.config.ts
import welcome from '@pages/welcome/welcome.vue'
  1. When import via relative path, ctrl + click welcome jump to shims-vue.d.ts, but click welcome.vue can show the defination info.
// router.config.ts
import welcome from '../pages/welcome/welcome.vue'
  1. 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"]
}
0 Answers
Related