Give vite
the ability to resolve imports using TypeScript's path mapping.
-
Install as dev dependency
-
Inject
vite-tsconfig-paths
using thevite.config.ts
moduleimport type { UserConfig } from 'vite' import tsconfigPaths from 'vite-tsconfig-paths' const config: UserConfig = { plugins: [ tsconfigPaths(), ], } export default config
Note: You need to restart Vite when you update your paths
mappings.
-
root: string
The root directory to loadtsconfig.json
from.
Defaults toviteConfig.root
-
extensions: string[]
File extensions to search for.
Defaults to.ts | .tsx | .js | .jsx | .json
If this package helps you, please donate! Any amount is greatly appreciated. 🥰
- ETH: 0xa446626195bbe4d0697e729c1433a86fB6Cf66cF
- BTC: 17vYtAUPKXzubMEnNcN8SiuFgicrd5Rp9A
- KIN: GBU7RDRD7VDVT254RR6PGMBJESXQVDHJ5CGGODZKRXM2P4MP3G5QSAMH