mirror of
https://github.com/formbricks/formbricks.git
synced 2026-01-25 18:48:58 -06:00
105 lines
3.0 KiB
JavaScript
105 lines
3.0 KiB
JavaScript
import { withSentryConfig } from "@sentry/nextjs";
|
|
import "./env.mjs";
|
|
import { createId } from "@paralleldrive/cuid2";
|
|
|
|
/** @type {import('next').NextConfig} */
|
|
|
|
const nextConfig = {
|
|
output: "standalone",
|
|
experimental: {
|
|
serverActions: true,
|
|
},
|
|
transpilePackages: [
|
|
"@formbricks/database",
|
|
"@formbricks/ee",
|
|
"@formbricks/ui",
|
|
"@formbricks/lib",
|
|
"@formbricks/errors",
|
|
],
|
|
images: {
|
|
remotePatterns: [
|
|
{
|
|
protocol: "https",
|
|
hostname: "avatars.githubusercontent.com",
|
|
},
|
|
{
|
|
protocol: "https",
|
|
hostname: "lh3.googleusercontent.com",
|
|
},
|
|
],
|
|
},
|
|
async headers() {
|
|
return [
|
|
{
|
|
// matching all API routes
|
|
source: "/api/v1/client/:path*",
|
|
headers: [
|
|
{ key: "Access-Control-Allow-Credentials", value: "true" },
|
|
{ key: "Access-Control-Allow-Origin", value: "*" },
|
|
{ key: "Access-Control-Allow-Methods", value: "GET,OPTIONS,PATCH,DELETE,POST,PUT" },
|
|
{
|
|
key: "Access-Control-Allow-Headers",
|
|
value:
|
|
"X-CSRF-Token, X-Requested-With, Accept, Accept-Version, Content-Length, Content-MD5, Content-Type, Date, X-Api-Version",
|
|
},
|
|
],
|
|
},
|
|
{
|
|
// matching all API routes
|
|
source: "/api/capture/:path*",
|
|
headers: [
|
|
{ key: "Access-Control-Allow-Credentials", value: "true" },
|
|
{ key: "Access-Control-Allow-Origin", value: "*" },
|
|
{ key: "Access-Control-Allow-Methods", value: "GET,OPTIONS,PATCH,DELETE,POST,PUT" },
|
|
{
|
|
key: "Access-Control-Allow-Headers",
|
|
value:
|
|
"X-CSRF-Token, X-Requested-With, Accept, Accept-Version, Content-Length, Content-MD5, Content-Type, Date, X-Api-Version",
|
|
},
|
|
],
|
|
},
|
|
];
|
|
},
|
|
env: {
|
|
INSTANCE_ID: createId(),
|
|
INTERNAL_SECRET: createId(),
|
|
},
|
|
};
|
|
|
|
const sentryOptions = {
|
|
// For all available options, see:
|
|
// https://github.com/getsentry/sentry-webpack-plugin#options
|
|
|
|
// Suppresses source map uploading logs during build
|
|
silent: true,
|
|
|
|
org: "formbricks",
|
|
project: "formbricks-cloud",
|
|
};
|
|
|
|
const sentryConfig = {
|
|
// For all available options, see:
|
|
// https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/
|
|
|
|
// Upload a larger set of source maps for prettier stack traces (increases build time)
|
|
widenClientFileUpload: true,
|
|
|
|
// Transpiles SDK to be compatible with IE11 (increases bundle size)
|
|
transpileClientSDK: true,
|
|
|
|
// Routes browser requests to Sentry through a Next.js rewrite to circumvent ad-blockers (increases server load)
|
|
tunnelRoute: "/monitoring",
|
|
|
|
// Hides source maps from generated client bundles
|
|
hideSourceMaps: true,
|
|
|
|
// Automatically tree-shake Sentry logger statements to reduce bundle size
|
|
disableLogger: true,
|
|
};
|
|
|
|
const exportConfig = process.env.NEXT_PUBLIC_SENTRY_DSN
|
|
? withSentryConfig(nextConfig, sentryOptions, sentryConfig)
|
|
: nextConfig;
|
|
|
|
export default exportConfig;
|