Created
February 26, 2023 03:13
-
-
Save christianvmm/6d61c9f4f9bf37d6d09a7bccf1759c85 to your computer and use it in GitHub Desktop.
Configuration to use absolute imports in Vite ReactApp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // tsconfig.json | |
| "references": [{ "path": "./tsconfig.node.json" }], | |
| "extends": "./tsconfig.paths.json" | |
| // create: tsconfig.paths.json | |
| { | |
| "compilerOptions": { | |
| "baseUrl": ".", | |
| "paths": { | |
| "@/*": ["./src/*"] | |
| } | |
| } | |
| } | |
| // vite.config.ts | |
| resolve: { | |
| alias: [{ find: '@', replacement: '/src' }], | |
| }, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment