Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

🔧 chore: refactor build scripts to prevent Vercel OOM (#12912)

sxjeruc07574af1261
diff --git a/package.json b/package.json
index afd77887804..9cdba4c84ea 100644
--- a/package.json
+++ b/package.json
@@ -37,11 +37,14 @@
"build": "bun run build:spa && bun run build:spa:copy && bun run build:next",
"build:analyze": "cross-env NODE_OPTIONS=--max-old-space-size=81920 next experimental-analyze",
"build:docker": "pnpm run build:spa && pnpm run build:spa:mobile && pnpm run build:spa:copy && cross-env NODE_OPTIONS=--max-old-space-size=8192 DOCKER=true next build && pnpm run build-sitemap",
- "build:next": "cross-env NODE_OPTIONS=--max-old-space-size=7168 next build",
- "build:spa": "rm -rf public/spa && cross-env NODE_OPTIONS=--max-old-space-size=7168 vite build",
+ "build:next": "cross-env NODE_OPTIONS=--max-old-space-size=7168 bun run build:next:raw",
+ "build:next:raw": "next build",
+ "build:raw": "bun run build:spa:raw && bun run build:spa:copy && bun run build:next:raw",
+ "build:spa": "cross-env NODE_OPTIONS=--max-old-space-size=7168 pnpm run build:spa:raw",
"build:spa:copy": "tsx scripts/copySpaBuild.mts && tsx scripts/generateSpaTemplates.mts",
"build:spa:mobile": "cross-env NODE_OPTIONS=--max-old-space-size=8192 MOBILE=true vite build",
- "build:vercel": "bun run build && bun run db:migrate",
+ "build:spa:raw": "rm -rf public/spa && vite build",
+ "build:vercel": "cross-env-shell NODE_OPTIONS=--max-old-space-size=6144 \"bun run build:raw && bun run db:migrate\"",
"build-migrate-db": "bun run db:migrate",
"build-sitemap": "tsx ./scripts/buildSitemapIndex/index.ts",
"clean:node_modules": "bash -lc 'set -e; echo \"Removing all node_modules...\"; rm -rf node_modules; pnpm -r exec rm -rf node_modules; rm -rf apps/desktop/node_modules; echo \"All node_modules removed.\"'",