Enable absolute paths in a TypeScript project
Import files with ~/
. Assumes a ./src
folder.
src/example.ts
-> ~/example
npx enable-absolute-paths@latest
If using vite
, add this to your vite.config.ts
resolve: {
alias: {
'~': resolve(__dirname, 'src'),
},
},