fix(frontend): 撤回 optimizeDeps.include 避免 element-plus 解析失败导致启动崩溃
问题原因: - 上一次提交添加的 optimizeDeps.include 让 Vite 在启动阶段 就硬解析 element-plus, 包安装不完整时直接崩 (服务器起不来) - predev 脚本每次清缓存, 如果源包有问题则重建必然失败 修正: - 移除 optimizeDeps.include, Vite 自动发现预构建即可 - predev 改为可选的 dev:clean 脚本, 不影响正常启动 - start.sh 加固: 检查 element-plus/es/index.mjs 是否存在 不存在则自动 npm install 影响范围: - 其他服务器 git pull 后, start.sh 会自动检测并安装缺失依赖 - 正常 npm run dev 不再每次清缓存, 启动更快
This commit is contained in:
@@ -11,18 +11,6 @@ export default defineConfig({
|
||||
'@': fileURLToPath(new URL('./src', import.meta.url))
|
||||
}
|
||||
},
|
||||
// 显式预构建 element-plus,避免 Vite 缓存过期后
|
||||
// 出现 "Failed to resolve entry for package element-plus" 错误
|
||||
optimizeDeps: {
|
||||
include: [
|
||||
'element-plus',
|
||||
'@element-plus/icons-vue',
|
||||
'vue',
|
||||
'vue-router',
|
||||
'pinia',
|
||||
'axios'
|
||||
]
|
||||
},
|
||||
server: {
|
||||
host: '0.0.0.0',
|
||||
port: 3000,
|
||||
|
||||
Reference in New Issue
Block a user