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:
(Bonus tip) Prefix ~/
to all internal import paths with the following compiler options in tsconfig.json
:
{
"compilerOptions": {
"baseUrl": ".",
"paths": {
"~/*": ["./*"]
}
},
}