Enable dynamic rendering and update Next.js config

Added 'force-dynamic' export to admin orders and status pages for dynamic rendering. Updated next.config.mjs to modularize imports for better tree-shaking and switched to Turbopack for optimal bundle sizes. Upgraded Next.js and related dependencies in package.json and package-lock.json.
This commit is contained in:
g
2025-12-31 07:05:26 +00:00
parent 66e95438fe
commit c31604d29a
7 changed files with 932 additions and 397 deletions

View File

@@ -4,6 +4,8 @@ import { Package, AlertTriangle } from "lucide-react";
import { fetchServer } from "@/lib/api"; import { fetchServer } from "@/lib/api";
import OrdersTable from "@/components/admin/OrdersTable"; import OrdersTable from "@/components/admin/OrdersTable";
export const dynamic = 'force-dynamic';
interface Order { interface Order {
orderId: string | number; orderId: string | number;
userId: string; userId: string;

View File

@@ -5,6 +5,8 @@ import { Server, Database, Cpu, HardDrive, Activity } from "lucide-react";
import { fetchServer } from "@/lib/api"; import { fetchServer } from "@/lib/api";
import SystemStatusCard from "@/components/admin/SystemStatusCard"; import SystemStatusCard from "@/components/admin/SystemStatusCard";
export const dynamic = 'force-dynamic';
interface SystemStatus { interface SystemStatus {
uptimeSeconds: number; uptimeSeconds: number;
memory: { memory: {

View File

@@ -51,6 +51,14 @@ const baseConfig = {
} : false, } : false,
}, },
poweredByHeader: false, poweredByHeader: false,
// Modularize imports for better tree-shaking (only for libraries that benefit from it)
modularizeImports: {
// date-fns: function-level imports for better tree-shaking
'date-fns': {
transform: 'date-fns/{{member}}',
},
},
// Webpack config (fallback if using --webpack flag)
webpack: (config, { isServer, dev }) => { webpack: (config, { isServer, dev }) => {
if (!isServer && !dev) { if (!isServer && !dev) {
// Only apply aggressive code splitting in production // Only apply aggressive code splitting in production
@@ -112,9 +120,9 @@ const baseConfig = {
typescript: { typescript: {
ignoreBuildErrors: true, ignoreBuildErrors: true,
}, },
eslint: { // Turbopack configuration for optimal bundle sizes
ignoreDuringBuilds: true, // Turbopack automatically handles code splitting and tree-shaking
}, turbopack: {},
}; };
const nextConfig = withBundleAnalyzer(baseConfig); const nextConfig = withBundleAnalyzer(baseConfig);

1294
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -54,7 +54,7 @@
"input-otp": "1.4.1", "input-otp": "1.4.1",
"jwt-decode": "^4.0.0", "jwt-decode": "^4.0.0",
"lucide-react": "^0.454.0", "lucide-react": "^0.454.0",
"next": "^15.2.6", "next": "^16.1.1",
"next-themes": "latest", "next-themes": "latest",
"react": "^19.0.0", "react": "^19.0.0",
"react-day-picker": "8.10.1", "react-day-picker": "8.10.1",
@@ -73,7 +73,7 @@
}, },
"devDependencies": { "devDependencies": {
"@distube/ytdl-core": "^4.16.12", "@distube/ytdl-core": "^4.16.12",
"@next/bundle-analyzer": "^15.4.6", "@next/bundle-analyzer": "^16.1.1",
"@tailwindcss/typography": "^0.5.16", "@tailwindcss/typography": "^0.5.16",
"@types/lodash": "^4.17.16", "@types/lodash": "^4.17.16",
"@types/node": "^22", "@types/node": "^22",
@@ -81,7 +81,7 @@
"@types/react-dom": "^18", "@types/react-dom": "^18",
"cross-env": "^7.0.3", "cross-env": "^7.0.3",
"eslint": "^9.19.0", "eslint": "^9.19.0",
"eslint-config-next": "^15.2.3", "eslint-config-next": "^16.1.1",
"postcss": "^8", "postcss": "^8",
"tailwindcss": "^3.4.17", "tailwindcss": "^3.4.17",
"typescript": "^5" "typescript": "^5"

View File

@@ -1,4 +1,4 @@
{ {
"commitHash": "18ac222", "commitHash": "66e9543",
"buildTime": "2025-12-31T06:46:19.353Z" "buildTime": "2025-12-31T07:04:51.067Z"
} }

View File

@@ -14,7 +14,7 @@
"moduleResolution": "bundler", "moduleResolution": "bundler",
"resolveJsonModule": true, "resolveJsonModule": true,
"isolatedModules": true, "isolatedModules": true,
"jsx": "preserve", "jsx": "react-jsx",
"incremental": true, "incremental": true,
"plugins": [ "plugins": [
{ {
@@ -32,7 +32,8 @@
"next-env.d.ts", "next-env.d.ts",
"**/*.ts", "**/*.ts",
"**/*.tsx", "**/*.tsx",
".next/types/**/*.ts" ".next/types/**/*.ts",
".next/dev/types/**/*.ts"
], ],
"exclude": [ "exclude": [
"node_modules" "node_modules"