From 6c0651e1be8eb16af02e629395f0d5cc11527638 Mon Sep 17 00:00:00 2001 From: eric Date: Tue, 24 Mar 2026 04:40:56 -0500 Subject: [PATCH] 's' --- next.config.js | 45 +++++++++++++++++++++++++++++++++++++++++++++ package.json | 2 +- 2 files changed, 46 insertions(+), 1 deletion(-) diff --git a/next.config.js b/next.config.js index b9fc559..a27ec0e 100644 --- a/next.config.js +++ b/next.config.js @@ -3,6 +3,14 @@ const nextConfig = { // Docker 部署支持 // output: 'standalone', + // 低配 VPS:降低 webpack 并行度,减少构建峰值内存(构建会变慢) + webpack: (config, { dev }) => { + if (!dev) { + config.parallelism = 1; + } + return config; + }, + images: { domains: [ "dash.cloudflare.com", @@ -34,6 +42,43 @@ const nextConfig = { serverActions: { allowedOrigins: ["localhost", "navsphere.com", "*.hackrobot.cn"], }, + // 按需解析 barrel 导出,减轻构建时 AST/模块图压力 + optimizePackageImports: [ + "lucide-react", + "date-fns", + "recharts", + "@tanstack/react-table", + "@tanstack/react-query", + "@hello-pangea/dnd", + "@radix-ui/react-accordion", + "@radix-ui/react-alert-dialog", + "@radix-ui/react-aspect-ratio", + "@radix-ui/react-avatar", + "@radix-ui/react-checkbox", + "@radix-ui/react-collapsible", + "@radix-ui/react-context-menu", + "@radix-ui/react-dialog", + "@radix-ui/react-dropdown-menu", + "@radix-ui/react-hover-card", + "@radix-ui/react-label", + "@radix-ui/react-menubar", + "@radix-ui/react-navigation-menu", + "@radix-ui/react-popover", + "@radix-ui/react-progress", + "@radix-ui/react-radio-group", + "@radix-ui/react-scroll-area", + "@radix-ui/react-select", + "@radix-ui/react-separator", + "@radix-ui/react-slider", + "@radix-ui/react-slot", + "@radix-ui/react-switch", + "@radix-ui/react-tabs", + "@radix-ui/react-toast", + "@radix-ui/react-toggle", + "@radix-ui/react-toggle-group", + "@radix-ui/react-toolbar", + "@radix-ui/react-tooltip", + ], }, // 加在这句话就够了 generateBuildId: async () => { diff --git a/package.json b/package.json index de59c5c..3bb4835 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ }, "scripts": { "dev": "next dev", - "build": "next build", + "build": "node --max-old-space-size=2048 ./node_modules/next/dist/bin/next build", "start": "next start", "lint": "next lint", "clean": "rm -rf .next",