2024-03-26 13:54:42 +00:00
|
|
|
/* eslint-disable @typescript-eslint/no-var-requires */
|
2024-05-08 17:31:20 +00:00
|
|
|
/** @type {import("next").NextConfig} */
|
2023-05-03 08:06:55 +00:00
|
|
|
require("dotenv").config({ path: ".env" });
|
2023-02-06 19:37:01 +00:00
|
|
|
const { withSentryConfig } = require("@sentry/nextjs");
|
2023-09-14 10:35:31 +00:00
|
|
|
|
2022-11-19 14:21:26 +00:00
|
|
|
const nextConfig = {
|
2024-04-06 11:43:24 +00:00
|
|
|
reactStrictMode: false,
|
|
|
|
swcMinify: true,
|
|
|
|
output: "standalone",
|
2023-12-20 08:19:17 +00:00
|
|
|
async headers() {
|
|
|
|
return [
|
|
|
|
{
|
|
|
|
source: "/(.*)?",
|
2024-05-08 17:31:20 +00:00
|
|
|
headers: [
|
|
|
|
{ key: "X-Frame-Options", value: "SAMEORIGIN" },
|
|
|
|
{
|
|
|
|
key: "Referrer-Policy",
|
|
|
|
value: "origin-when-cross-origin",
|
|
|
|
},
|
|
|
|
],
|
2023-12-20 08:19:17 +00:00
|
|
|
},
|
|
|
|
];
|
|
|
|
},
|
2022-11-19 14:21:26 +00:00
|
|
|
images: {
|
2023-11-03 13:39:40 +00:00
|
|
|
remotePatterns: [
|
|
|
|
{
|
|
|
|
protocol: "https",
|
|
|
|
hostname: "**",
|
|
|
|
},
|
2023-02-07 05:50:41 +00:00
|
|
|
],
|
2023-10-27 07:44:03 +00:00
|
|
|
unoptimized: true,
|
2022-11-19 14:21:26 +00:00
|
|
|
},
|
2024-05-21 08:13:54 +00:00
|
|
|
async redirects() {
|
|
|
|
return [
|
|
|
|
{
|
|
|
|
source: "/accounts/sign-up",
|
2024-05-22 09:19:06 +00:00
|
|
|
destination: "/sign-up",
|
2024-06-10 06:46:23 +00:00
|
|
|
permanent: true,
|
2024-05-22 09:19:06 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
source: "/sign-in",
|
2024-05-21 08:13:54 +00:00
|
|
|
destination: "/",
|
2024-06-10 06:46:23 +00:00
|
|
|
permanent: true,
|
2024-05-22 12:01:56 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
source: "/register",
|
|
|
|
destination: "/sign-up",
|
2024-06-10 06:46:23 +00:00
|
|
|
permanent: true,
|
2024-05-22 12:01:56 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
source: "/login",
|
|
|
|
destination: "/",
|
2024-06-10 06:46:23 +00:00
|
|
|
permanent: true,
|
|
|
|
},
|
|
|
|
];
|
2024-05-21 08:13:54 +00:00
|
|
|
},
|
2024-04-06 11:43:24 +00:00
|
|
|
async rewrites() {
|
2024-05-28 07:38:37 +00:00
|
|
|
const posthogHost = process.env.NEXT_PUBLIC_POSTHOG_HOST || "https://app.posthog.com"
|
2024-05-09 21:02:42 +00:00
|
|
|
const rewrites = [
|
2024-04-06 11:43:24 +00:00
|
|
|
{
|
|
|
|
source: "/ingest/static/:path*",
|
2024-05-28 07:38:37 +00:00
|
|
|
destination: `${posthogHost}/static/:path*`,
|
2024-04-06 11:43:24 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
source: "/ingest/:path*",
|
2024-05-28 07:38:37 +00:00
|
|
|
destination: `${posthogHost}/:path*`,
|
2024-04-06 11:43:24 +00:00
|
|
|
},
|
2024-05-08 17:31:20 +00:00
|
|
|
];
|
2024-05-09 21:02:42 +00:00
|
|
|
if (process.env.NEXT_PUBLIC_ADMIN_BASE_URL || process.env.NEXT_PUBLIC_ADMIN_BASE_PATH) {
|
2024-06-10 06:46:23 +00:00
|
|
|
const ADMIN_BASE_URL = process.env.NEXT_PUBLIC_ADMIN_BASE_URL || "";
|
|
|
|
const ADMIN_BASE_PATH = process.env.NEXT_PUBLIC_ADMIN_BASE_PATH || "";
|
|
|
|
const GOD_MODE_BASE_URL = ADMIN_BASE_URL + ADMIN_BASE_PATH;
|
2024-05-24 14:34:00 +00:00
|
|
|
rewrites.push({
|
|
|
|
source: "/god-mode",
|
|
|
|
destination: `${GOD_MODE_BASE_URL}/`,
|
|
|
|
})
|
2024-05-09 21:02:42 +00:00
|
|
|
rewrites.push({
|
|
|
|
source: "/god-mode/:path*",
|
|
|
|
destination: `${GOD_MODE_BASE_URL}/:path*`,
|
2024-06-10 06:46:23 +00:00
|
|
|
});
|
2024-05-09 21:02:42 +00:00
|
|
|
}
|
|
|
|
return rewrites;
|
2024-05-08 17:31:20 +00:00
|
|
|
},
|
2022-11-19 14:21:26 +00:00
|
|
|
};
|
|
|
|
|
2024-05-27 09:32:03 +00:00
|
|
|
const sentryConfig = {
|
|
|
|
// For all available options, see:
|
|
|
|
// https://github.com/getsentry/sentry-webpack-plugin#options
|
|
|
|
org: process.env.SENTRY_ORG_ID || "plane-hq",
|
|
|
|
project: process.env.SENTRY_PROJECT_ID || "plane-web",
|
|
|
|
authToken: process.env.SENTRY_AUTH_TOKEN,
|
|
|
|
// Only print logs for uploading source maps in CI
|
|
|
|
silent: true,
|
|
|
|
|
|
|
|
// Upload a larger set of source maps for prettier stack traces (increases build time)
|
|
|
|
widenClientFileUpload: true,
|
|
|
|
|
|
|
|
// Route browser requests to Sentry through a Next.js rewrite to circumvent ad-blockers.
|
|
|
|
// This can increase your server load as well as your hosting bill.
|
|
|
|
// Note: Check that the configured route will not match with your Next.js middleware, otherwise reporting of client-
|
|
|
|
// side errors will fail.
|
|
|
|
tunnelRoute: "/monitoring",
|
|
|
|
|
|
|
|
// Hides source maps from generated client bundles
|
|
|
|
hideSourceMaps: true,
|
|
|
|
|
|
|
|
// Automatically tree-shake Sentry logger statements to reduce bundle size
|
|
|
|
disableLogger: true,
|
|
|
|
|
|
|
|
// Enables automatic instrumentation of Vercel Cron Monitors. (Does not yet work with App Router route handlers.)
|
|
|
|
// See the following for more information:
|
|
|
|
// https://docs.sentry.io/product/crons/
|
|
|
|
// https://vercel.com/docs/cron-jobs
|
|
|
|
automaticVercelMonitors: true,
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (parseInt(process.env.SENTRY_MONITORING_ENABLED || "0", 10)) {
|
|
|
|
module.exports = withSentryConfig(nextConfig, sentryConfig);
|
2023-02-08 15:14:35 +00:00
|
|
|
} else {
|
|
|
|
module.exports = nextConfig;
|
|
|
|
}
|