TypeScript 5.9 起 baseUrl 被标记弃用(TS 7.0 将移除),VS Code 会在 tsconfig.json 里画橙色波浪线。
去掉 baseUrl,paths 改成相对 tsconfig 的写法(TS 4.4+ 支持无 baseUrl 的 paths):
"paths": { "@/*": ["./src/*"] }
Vite 侧的同名别名在 vite.config.ts 里单独配,不受影响;vue-tsc --noEmit + vite build 通过。
顺带在根 .gitignore 里加上 .tmp-*(联调用的临时脚本,跑完即删,不该进仓库)。
24 lines
603 B
JSON
24 lines
603 B
JSON
{
|
|
"compilerOptions": {
|
|
"target": "ES2022",
|
|
"module": "ESNext",
|
|
"moduleResolution": "bundler",
|
|
"lib": ["ES2022", "DOM", "DOM.Iterable"],
|
|
"strict": true,
|
|
"noUnusedLocals": true,
|
|
"noUnusedParameters": true,
|
|
"noFallthroughCasesInSwitch": true,
|
|
"jsx": "preserve",
|
|
"resolveJsonModule": true,
|
|
"isolatedModules": true,
|
|
"esModuleInterop": true,
|
|
"skipLibCheck": true,
|
|
"noEmit": true,
|
|
"types": ["vite/client", "node"],
|
|
"paths": {
|
|
"@/*": ["./src/*"]
|
|
}
|
|
},
|
|
"include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.vue", "vite.config.ts"]
|
|
}
|