DEV Community

Discussion on: How To Create Absolute Imports In Vite React App: A step-by-step Guide

Collapse
 
ajith_pious_0c0f9e171c64f profile image
ajith pious • Edited

installing the plugin vite-tsconfig-paths and adding the below in tsconfig.json

"compilerOptions": {
    // ...other options
    "paths": {
      "*": ["./src/*"]
    }
  }
Enter fullscreen mode Exit fullscreen mode

and vite.config.js with

import tsconfigPaths from 'vite-tsconfig-paths';
export default {
  plugins: [tsconfigPaths(), react(),],
};
Enter fullscreen mode Exit fullscreen mode