Info

Typescript๋ฅผ ์‚ฌ์šฉํ•˜๋ฏ€๋กœ tsconfig.json๋ฅผ ํ†ตํ•ด ํ”„๋กœ์ ํŠธ ์„ธํŒ…์„ ํ•  ์ˆ˜ ์žˆ์Œ.
ํ˜„์žฌ๋Š” vite ๊ธฐ๋ณธ ์„ค์ • ํŒŒ์ผ์—

  • rootDirs
  • baseUrl
  • paths (alias)
    ๋งŒ ์„ธํŒ…ํ•˜์—ฌ ์‚ฌ์šฉ ์ค‘.

Source

tsconfig.json
{  
  "compilerOptions": {  
    "jsx": "react",  
    "target": "es6",  
    "module": "esnext",  
    "moduleResolution": "node",  
    "allowSyntheticDefaultImports": true,  
    "lib": [  
      "es7",  
      "dom"  
    ],  
    "rootDirs": [  
      "./src"  
    ],  
    "baseUrl": "./src",  
    // setting alias
    "paths": {  
      "@/*": [  
        "/*"  
      ],  
      "@assets/*": [  
        "assets/*"  
      ],  
      "@components/*": [  
        "components/*"  
      ],  
      "@views/*": [  
        "views/*"  
      ],  
      "@repositories/*": [  
        "repositories/*"  
      ],  
      "@stores/*": [  
        "stores/*"  
      ],  
      "@typings/*": [  
        "typings/*"  
      ],  
      "@utils/*": [  
        "utils/*"  
      ],  
    }  
  }  
}