mirror of
https://github.com/prowler-cloud/prowler.git
synced 2026-10-04 02:04:06 +00:00
Co-authored-by: alejandrobailo <alejandrobailo94@gmail.com>
78 lines
2.4 KiB
JavaScript
78 lines
2.4 KiB
JavaScript
const dotenv = require("dotenv");
|
|
const dotenvExpand = require("dotenv-expand");
|
|
dotenvExpand.expand(dotenv.config({ path: "../.env", quiet: true }));
|
|
const { withSentryConfig } = require("@sentry/nextjs");
|
|
|
|
/** @type {import('next').NextConfig} */
|
|
|
|
// HTTP Security Headers
|
|
const nextConfig = {
|
|
poweredByHeader: false,
|
|
// Server Function arguments include write-only credentials.
|
|
logging: { serverFunctions: false },
|
|
// Dev-only. Lets the dev server accept HMR/asset requests from a tunnel
|
|
// hostname (ngrok/cloudflared), needed when testing the local UI through a
|
|
// public tunnel or from an external device.
|
|
// Comma-separated, e.g. NEXT_ALLOWED_DEV_ORIGINS=foo.ngrok-free.dev
|
|
allowedDevOrigins: (process.env.NEXT_ALLOWED_DEV_ORIGINS || "")
|
|
.split(",")
|
|
.map((origin) => origin.trim())
|
|
.filter(Boolean),
|
|
// Use standalone only in production deployments, not for CI/testing
|
|
...(process.env.NODE_ENV === "production" &&
|
|
!process.env.CI && {
|
|
output: "standalone",
|
|
outputFileTracingRoot: __dirname,
|
|
// sharp 0.35 loads its native binary dynamically, so tracing misses it.
|
|
outputFileTracingIncludes: {
|
|
"**": ["./node_modules/.pnpm/@img+sharp-libvips-linuxmusl-*/**/*"],
|
|
},
|
|
}),
|
|
// React Compiler is now stable in Next.js 16
|
|
reactCompiler: true,
|
|
turbopack: {
|
|
root: __dirname,
|
|
},
|
|
async headers() {
|
|
const headers = [
|
|
{
|
|
key: "X-Content-Type-Options",
|
|
value: "nosniff",
|
|
},
|
|
{
|
|
key: "Referrer-Policy",
|
|
value: "strict-origin-when-cross-origin",
|
|
},
|
|
];
|
|
|
|
return [
|
|
{
|
|
source: "/(.*)",
|
|
headers,
|
|
},
|
|
];
|
|
},
|
|
};
|
|
|
|
// Sentry configuration options
|
|
const sentryWebpackPluginOptions = {
|
|
org: process.env.SENTRY_ORG,
|
|
project: process.env.SENTRY_PROJECT,
|
|
authToken: process.env.SENTRY_AUTH_TOKEN,
|
|
silent: true, // Suppresses all logs
|
|
hideSourceMaps: true, // Hides source maps from generated client bundles
|
|
disableLogger: true, // Automatically tree-shake Sentry logger statements to reduce bundle size
|
|
widenClientFileUpload: true, // Upload a larger set of source maps for prettier stack traces
|
|
};
|
|
|
|
// Export with Sentry only if configuration is available
|
|
const hasSentryBuildCredentials = Boolean(
|
|
process.env.SENTRY_AUTH_TOKEN &&
|
|
process.env.SENTRY_ORG &&
|
|
process.env.SENTRY_PROJECT,
|
|
);
|
|
|
|
module.exports = hasSentryBuildCredentials
|
|
? withSentryConfig(nextConfig, sentryWebpackPluginOptions)
|
|
: nextConfig;
|