'VSCode: No auto-suggestion while importing modules in node express app

I am using babel, eslint, and prettier for Node Rest API. To use absolute path I am using a package called babel-plugin-module-resolver but when I do use ES6 imports, I noticed that there is no auto suggestions. However, when I use relative path, everything seems to work perfectly fine.

Relative Path (Desired behavior with ES6 import and Absolute path) enter image description here

Absoulte Path (No suggestions) enter image description here

Here are my configuration files

1. package.json

{
  "name": "prod-js-starter",
  "version": "1.0.0",
  "description": "Production level starter for node.js based express RESTFull APIs",
  "main": "src/server.js",
  "keywords": [],
  "author": "",
  "license": "ISC",
  "scripts": {
    "build": "npm run clean && babel ./src --out-dir build --copy-files",
    "start": "NODE_ENV=production node build/server.js",
    "dev": "nodemon --exec babel-node src/server.js",
    "clean": "rm -rf build"
  },
  "dependencies": {
    "dotenv": "^16.0.0",
    "express": "^4.17.3",
    "module-alias": "^2.2.2"
  },
  "devDependencies": {
    "@babel/cli": "^7.17.6",
    "@babel/core": "^7.17.9",
    "@babel/node": "^7.16.8",
    "@babel/preset-env": "^7.16.11",
    "babel-plugin-module-resolver": "^4.1.0",
    "eslint": "^8.13.0",
    "eslint-config-airbnb-base": "^15.0.0",
    "eslint-config-prettier": "^8.5.0",
    "eslint-import-resolver-babel-module": "^5.3.1",
    "eslint-plugin-import": "^2.26.0",
    "eslint-plugin-prettier": "^4.0.0",
    "nodemon": "^2.0.15",
    "prettier": "^2.6.2"
  }
}

2. eslint.json

{
  "env": {
    "es2021": true
  },
  "extends": ["airbnb-base", "prettier"],
  "parserOptions": {
    "ecmaVersion": "latest"
  },
  "rules": {
    // "func-names": "off",
    "prettier/prettier": "error",
    "no-unused-vars": "warn",
    "no-console": "warn"
  },
  "plugins": ["prettier"],
  "settings": {
    "import/resolver": {
      "babel-module": {}
    }
  }
}

3. .babelrc

{
  "presets": ["@babel/preset-env"],
  "plugins": [
    [
      "module-resolver",
      {
        "root": ["."],
        "alias": {
          "@src": "./src"
        }
      }
    ]
  ]
}

Please help me to get those suggestions working like before. Its a simple feature but quite efficient.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source