Skip to content

Vite

安装

bash
npm create vite@latest
yarn create vite
pnpm create vite

配置 alias

vite.config.ts

ts
import path from 'path'

resolve: {
  alias: { '@': path.resolve(__dirname, 'src') }, 
},

tsconfig.json

json
{
  "compilerOptions": {
    "baseUrl": "./", 
    "paths": { "@/*": ["src/*"] } 
  }
}

参考

Vite 官网