Files
hats-app/next.config.ts
T
Ichsan Kurniawan d10603acc8 Optimize Next.js memory and handle 404s
Configure startup and package-import optimizations, exclude generated Next.js files from TypeScript checks, and route fetch responses with status 404 to the not-found page.
2026-11-18 18:20:27 +07:00

39 lines
1.3 KiB
TypeScript

import type { NextConfig } from "next";
const nextConfig: NextConfig = {
/* config options here */
basePath: process.env.BASE_PATH ?? '',
env: {
'BASE_PATH': process.env.BASE_PATH ?? '',
'BASE_URL_API': process.env.BASE_URL_API,
'BASE_URL_IMG': process.env.BASE_URL_IMG,
'FIREBASE_API_KEY': process.env.FIREBASE_API_KEY,
'FIREBASE_APP_ID': process.env.FIREBASE_APP_ID,
'DEVICE_CODE': process.env.DEVICE_CODE,
},
images: {
// unoptimized: true, // <--- ADD THIS LINE
remotePatterns: [
new URL('https://36.66.3.44/**'),
new URL('https://his.nutech-integrasi.com/**'),
new URL('https://hats.hisnutech.my.id/**'),
new URL('https://api-hats.hisnutech.my.id/**'),
{ protocol: 'https', hostname: 'avatars.githubusercontent.com', pathname: '/u/**/*' },
{ protocol: 'https', hostname: 'lh3.googleusercontent.com', pathname: '/a/**/*' }
],
qualities: [50, 65, 70, 75, 80, 85, 90, 100],
},
reactCompiler: true,
reactStrictMode: false,
experimental: {
authInterrupts: true, // for forbidden page
// MEMORY OPTIMIZING
// 1. Prevent Next.js from loading all route modules into RAM at startup
preloadEntriesOnStart: false,
// 2. Optimize barrel imports (e.g., lucide-react, @mui/icons-material, lodash)
optimizePackageImports: ['lucide-react', 'date-fns', 'lodash'],
},
};
export default nextConfig;