- Refactored ESLint configuration for better clarity and organization, including updates to TypeScript rules and Next.js app settings. - Upgraded package dependencies, including Next.js to version 16.0.8 and Prisma to version 7.1.0, enhancing performance and compatibility. - Modified Dockerfile for BFF to reflect updated Prisma version and optimize build settings. - Improved Prisma service to utilize PostgreSQL connection pooling with the new PrismaPg adapter, ensuring better database management. - Cleaned up TypeScript configuration files for consistency and updated module settings to align with ESNext standards. - Adjusted pre-commit script to streamline security audits and removed unnecessary linting during development.
96 lines
2.6 KiB
JavaScript
96 lines
2.6 KiB
JavaScript
/* eslint-env node */
|
|
import bundleAnalyzer from "@next/bundle-analyzer";
|
|
import path from "node:path";
|
|
import { fileURLToPath } from "node:url";
|
|
|
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
const workspaceRoot = path.resolve(__dirname, "..", "..");
|
|
|
|
const withBundleAnalyzer = bundleAnalyzer({
|
|
enabled: process.env.ANALYZE === "true",
|
|
});
|
|
|
|
/** @type {import('next').NextConfig} */
|
|
const nextConfig = {
|
|
output: process.env.NODE_ENV === "production" ? "standalone" : undefined,
|
|
|
|
serverExternalPackages: [
|
|
"pino",
|
|
"pino-pretty",
|
|
"pino-abstract-transport",
|
|
"thread-stream",
|
|
"sonic-boom",
|
|
"tailwind-merge",
|
|
],
|
|
|
|
turbopack: {
|
|
resolveAlias: {
|
|
"@customer-portal/domain": path.join(workspaceRoot, "packages/domain/dist"),
|
|
},
|
|
},
|
|
|
|
webpack(config) {
|
|
config.resolve.alias = {
|
|
...config.resolve.alias,
|
|
"@customer-portal/domain": path.join(workspaceRoot, "packages/domain/dist"),
|
|
};
|
|
return config;
|
|
},
|
|
|
|
env: {
|
|
NEXT_PUBLIC_API_BASE: process.env.NEXT_PUBLIC_API_BASE,
|
|
NEXT_PUBLIC_APP_NAME: process.env.NEXT_PUBLIC_APP_NAME,
|
|
NEXT_PUBLIC_APP_VERSION: process.env.NEXT_PUBLIC_APP_VERSION,
|
|
},
|
|
|
|
images: {
|
|
remotePatterns: [{ protocol: "https", hostname: "**" }],
|
|
},
|
|
|
|
async rewrites() {
|
|
if (process.env.NODE_ENV !== "production") {
|
|
return [{ source: "/api/:path*", destination: "http://localhost:4000/api/:path*" }];
|
|
}
|
|
return [];
|
|
},
|
|
|
|
async headers() {
|
|
const isDev = process.env.NODE_ENV === "development";
|
|
return [
|
|
{
|
|
source: "/(.*)",
|
|
headers: [
|
|
{ key: "X-Frame-Options", value: "DENY" },
|
|
{ key: "X-Content-Type-Options", value: "nosniff" },
|
|
{ key: "Referrer-Policy", value: "strict-origin-when-cross-origin" },
|
|
{ key: "X-XSS-Protection", value: "1; mode=block" },
|
|
{
|
|
key: "Content-Security-Policy",
|
|
value: [
|
|
"default-src 'self'",
|
|
"script-src 'self' 'unsafe-inline' 'unsafe-eval'",
|
|
"style-src 'self' 'unsafe-inline'",
|
|
"img-src 'self' data: https:",
|
|
"font-src 'self' data:",
|
|
`connect-src 'self' https:${isDev ? " http://localhost:*" : ""}`,
|
|
"frame-ancestors 'none'",
|
|
].join("; "),
|
|
},
|
|
],
|
|
},
|
|
];
|
|
},
|
|
|
|
compiler: {
|
|
removeConsole: process.env.NODE_ENV === "production",
|
|
},
|
|
|
|
experimental: {
|
|
optimizePackageImports: ["@heroicons/react", "@tanstack/react-query"],
|
|
},
|
|
|
|
typescript: { ignoreBuildErrors: false },
|
|
};
|
|
|
|
export default withBundleAnalyzer(nextConfig);
|