修复:添加 Vite 路径别名配置
问题:Docker 构建时 Vite 无法解析 @/ 路径别名 原因:vite.config.ts 缺少 resolve.alias 配置 解决:添加 @ 别名指向 ./src 目录 Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { defineConfig } from "vite";
|
||||
import vue from "@vitejs/plugin-vue";
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [
|
||||
@@ -20,6 +21,11 @@ export default defineConfig({
|
||||
},
|
||||
},
|
||||
],
|
||||
resolve: {
|
||||
alias: {
|
||||
"@": fileURLToPath(new URL("./src", import.meta.url)),
|
||||
},
|
||||
},
|
||||
server: {
|
||||
host: true,
|
||||
port: 5173,
|
||||
|
||||
Reference in New Issue
Block a user