How to intellisense alias module path in VSCode

In the settings.json file, add this line:

"typescript.preferences.importModuleSpecifier": "non-relative"

If this property is removed, then the ugly relative auto-import is the default option. Simply change ‘typescript’ to ‘javascript’ if you’re currently using JS. To know more about this setting option, just hover on it like this:

Auto-import for JS/TS in VSCode

(Bonus tip) Prefix ~/ to all internal import paths with the following compiler options in tsconfig.json:

  "compilerOptions": {
    "baseUrl": ".",
    "paths": {
      "~/*": ["./*"]

Leave a Comment