Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vue js and VS code - no Intellisense for absolute file path

I have an app created using vue-cli 3 and I am using Visual Studio as my IDE. I have installed Vetur extension. Unfortunately when I am typing something like that

import Message from '@/components/Message'

VS code does not provide any Intellisense for resolving such an absolute file path. Maybe VS code does not understand that @ maps to 'src' folder in projects created using vue-cli. Does anybody know how to solve that problem?

I will be very grateful for any help.

like image 261
Mikołaj Waśniewski Avatar asked Feb 03 '23 18:02

Mikołaj Waśniewski


2 Answers

I have setup jsconfig.json in following manner and it works

{
  "compilerOptions": {
    "paths": {
      "@/*": [
        "src/*"
      ]
    }
  }
}
like image 135
Samiullah Khan Avatar answered Feb 07 '23 19:02

Samiullah Khan


You 'd be needing a jsconfig.json file for the Intellisense to kick in with webpack aliases. You can check the linked article.

https://medium.com/@justintulk/solve-module-import-aliasing-for-webpack-jest-and-vscode-74007ce4adc9

like image 37
infinity Avatar answered Feb 07 '23 18:02

infinity