VSCode Intellisense does not work with webpack + alias

Just to add to Matt's answer, in a TypeScript project you don't need to create a jsconfig.json file, you can simply add it to your tsconfig.json file and vscode picks it up.

{
    "compilerOptions": {
    ...
        "paths": {
            "@MyAlias/*": ["./myDirectrory/*"]
        }
    }
}

Try creating a jsconfig.json and configuring the paths compiler options

{
  "compilerOptions": {
    "baseUrl": ".",
    "module": "commonjs",
    "paths": {
      "@cmp/*": ["./src/components/*"]
    }
  }
}

You can find more information about paths and other compiler options here


This worked for me, as suggested here (I wanted @/ to resolve to ./src/):

{
  "compilerOptions": {
    "target": "es2017",
    "allowSyntheticDefaultImports": false,
    "baseUrl": "./",
    "paths": {
      "@/*": ["src/*"],
    }
  },
  "exclude": ["node_modules", "dist"]
}

Minimal version, but I'd leave exclude too:

{
  "compilerOptions": {
    "baseUrl": "./",
    "paths": {
      "@/*": ["src/*"]
    }
  },
}