A simple and beautiful blog
1、在配置文件中写入别名
123456789101112
// vite.config.tsexport default defineConfig({ ... resolve: { alias: [ // 设置别名 { find: '@', replacement: resolve(__dirname, 'src') } ] },})
2、在tsconfig.json中配置
123456789
// tsconfig.json"compilerOptions": { ... "baseUrl": ".", "paths": { "@/*": ["src/*"] }}
Seraching...