Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

react vite absolute imports

{
  "paths": {
      "@/*": ["src/*"]
    }
  // ...
}


// vite.config.ts
{
  resolve: {
   alias: [{ find: '@', replacement: '/src' }],
  },
  // ...
}

// then you'd import like this
import Image from @assets/image.png
 
PREVIOUS NEXT
Tagged: #react #vite #absolute #imports
ADD COMMENT
Topic
Name
8+8 =