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:
Your Name
2026-07-23 14:35:17 +08:00
parent 8a94f535de
commit 6076e174d5
3 changed files with 3 additions and 15 deletions
+2 -2
View File
@@ -138,8 +138,8 @@ start_frontend() {
cd $FRONTEND_DIR
# 检查 node_modules
if [ ! -d "node_modules" ]; then
# 检查 node_modules 及关键依赖是否完整
if [ ! -d "node_modules" ] || [ ! -f "node_modules/element-plus/es/index.mjs" ]; then
echo -e "${YELLOW}安装前端依赖...${NC}"
npm install
fi