Files
ipam/frontend/vite.config.js
T
Your Name ee0552f837 fix(frontend): 移除 element-plus alias 防止 CSS 路径解析失败
问题原因:
- 上次提交在 vite.config.js resolve.alias 中将 element-plus
  直接映射到 es/index.mjs 文件路径
- 这导致 import 'element-plus/dist/index.css' 时,
  Vite 拼接路径为 es/index.mjs/dist/index.css,文件不存在
- 报错: Failed to resolve import 'element-plus/dist/index.css'

解决方案:
- 移除 element-plus 的 resolve.alias 映射
- 包名保留为包名,Vite 的 node_modules 解析机制可正确处理
  element-plus 的 JS 入口和 CSS 路径
- start.sh 已有清缓存+自动重试机制兜底
2026-07-23 15:05:35 +08:00

27 lines
568 B
JavaScript

import { fileURLToPath, URL } from 'node:url'
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [vue()],
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url))
}
},
server: {
host: '0.0.0.0',
port: 3000,
// 允许任意 Host 头访问(HMR WebSocket 在远程访问时需要)
allowedHosts: true,
proxy: {
'/api': {
target: 'http://localhost:8008',
changeOrigin: true
}
}
}
})