'tsconfig paths definitions show module not found

I want to use @ sign for imports and I configured the tsconfig file like so:

{
  "compilerOptions": {
    "target": "es5",
    "lib": ["dom", "dom.iterable", "esnext"],
    "allowJs": true,
    "skipLibCheck": true,
    "esModuleInterop": true,
    "allowSyntheticDefaultImports": true,
    "strict": true,
    "forceConsistentCasingInFileNames": true,
    "noFallthroughCasesInSwitch": true,
    "module": "esnext",
    "moduleResolution": "node",
    "resolveJsonModule": true,
    "isolatedModules": true,
    "noEmit": true,
    "jsx": "react-jsx",
    "rootDirs": ["src"],
    "baseUrl": "./src",
    "paths": {
      "@/*": ["./*"]
    }
  },
  "include": ["src"]
}

but when I write any import statements starting with @ it fails to build.

import { Breadcrumb } from "@/components/Breadcrumb";

Module not found: Error: Can't resolve '@/components/Breadcrumb' in '/Users/armenbabakanian/github/grayhound/grayhound-backend/frontend/src/account/AccountGallery'

here is the folder structure:

.
|__ node_modules/
├── public
└── src
    ├── Home
    ├── Navbar
    ├── SignIn
    ├── SignUp
    ├── account
    ├── api
    ├── components
    ├── hooks
    ├── inventory
    └── libs

any ideas what I am missing?



Sources

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

Source: Stack Overflow

Solution Source