Skip to content

Instantly share code, notes, and snippets.

@christianvmm
Created February 26, 2023 03:13
Show Gist options
  • Select an option

  • Save christianvmm/6d61c9f4f9bf37d6d09a7bccf1759c85 to your computer and use it in GitHub Desktop.

Select an option

Save christianvmm/6d61c9f4f9bf37d6d09a7bccf1759c85 to your computer and use it in GitHub Desktop.
Configuration to use absolute imports in Vite ReactApp
// 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