#How to use path in vite config with Typescript

1 messages · Page 1 of 1 (latest)

south vault
#

Hello there! I have an issue while trying to use path in my vite.config with Typescript
I did the following in a vue app ( made in JS ), and now I would like to do the same with my new React app, but I'm using Typescript

import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'

import path from 'path'

// https://vitejs.dev/config/

export default defineConfig({

    resolve:{

        alias:{

          '@' : path.resolve(__dirname, './src')

        },
  
    },

    plugins: [vue()]
  
})

How could I do the same thing with typescript ?
It's telling me that __dirname doesnt exists

zinc blaze
#
// tsconfig.json
{
  "compilerOptions": {
    "baseUrl": ".",
    "paths": {
      "@/*": ["src/*"]
    },
    // ...other
  }
}
south vault
south vault
#

Typescript does not show any error while coding

#

But

#

When I compile the code

#

Then it doesnt work, saying that ts cannot find module