98 lines
2.4 KiB
JavaScript
98 lines
2.4 KiB
JavaScript
/** @type {import('next').NextConfig} */
|
||
const nextConfig = {
|
||
// Docker 部署支持
|
||
// output: 'standalone',
|
||
|
||
// 低配 VPS:降低 webpack 并行度,减少构建峰值内存(构建会变慢)
|
||
webpack: (config, { dev }) => {
|
||
if (!dev) {
|
||
config.parallelism = 1;
|
||
}
|
||
return config;
|
||
},
|
||
|
||
images: {
|
||
domains: [
|
||
"dash.cloudflare.com",
|
||
"www.google.com",
|
||
"ph-static.imgix.net",
|
||
"app.leonardo.ai",
|
||
],
|
||
remotePatterns: [
|
||
{
|
||
protocol: "https",
|
||
hostname: "**",
|
||
},
|
||
],
|
||
},
|
||
async rewrites() {
|
||
return [
|
||
{
|
||
source: "/api/auth/:path*",
|
||
destination: "/api/auth/:path*",
|
||
},
|
||
{
|
||
source: "/auth/:path*",
|
||
destination: "/auth/:path*",
|
||
},
|
||
];
|
||
},
|
||
// Cloudflare Pages configuration
|
||
experimental: {
|
||
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 () => {
|
||
return "v" + new Date().getTime();
|
||
},
|
||
headers: async () => [
|
||
{
|
||
source: "/:path*",
|
||
headers: [
|
||
{ key: "Cache-Control", value: "no-cache, no-store, must-revalidate" },
|
||
],
|
||
},
|
||
],
|
||
};
|
||
|
||
module.exports = nextConfig;
|