2024-03-26 19:24:42 +05:30
|
|
|
/* eslint-disable @typescript-eslint/no-var-requires */
|
2024-05-08 23:01:20 +05:30
|
|
|
/** @type {import("next").NextConfig} */
|
2023-05-03 13:36:55 +05:30
|
|
|
require("dotenv").config({ path: ".env" });
|
2024-08-05 15:30:17 +05:30
|
|
|
// const path = require("path");
|
2024-08-05 13:37:35 +05:30
|
|
|
|
2023-02-07 01:07:01 +05:30
|
|
|
const { withSentryConfig } = require("@sentry/nextjs");
|
2023-09-14 16:05:31 +05:30
|
|
|
|
2022-11-19 19:51:26 +05:30
|
|
|
const nextConfig = {
|
2024-06-14 17:00:35 +05:30
|
|
|
trailingSlash: true,
|
2024-04-06 17:13:24 +05:30
|
|
|
reactStrictMode: false,
|
|
|
|
|
swcMinify: true,
|
|
|
|
|
output: "standalone",
|
2023-12-20 13:49:17 +05:30
|
|
|
async headers() {
|
|
|
|
|
return [
|
|
|
|
|
{
|
|
|
|
|
source: "/(.*)?",
|
2024-05-08 23:01:20 +05:30
|
|
|
headers: [
|
|
|
|
|
{ key: "X-Frame-Options", value: "SAMEORIGIN" },
|
2024-10-11 20:13:38 +05:30
|
|
|
// {
|
|
|
|
|
// key: "Referrer-Policy",
|
|
|
|
|
// value: "origin-when-cross-origin",
|
|
|
|
|
// },
|
|
|
|
|
// { key: "Cross-Origin-Opener-Policy", value: "same-origin" },
|
|
|
|
|
// { key: "Cross-Origin-Embedder-Policy", value: "credentialless" },
|
2024-05-08 23:01:20 +05:30
|
|
|
],
|
2023-12-20 13:49:17 +05:30
|
|
|
},
|
|
|
|
|
];
|
|
|
|
|
},
|
2022-11-19 19:51:26 +05:30
|
|
|
images: {
|
2023-10-27 13:14:03 +05:30
|
|
|
unoptimized: true,
|
2022-11-19 19:51:26 +05:30
|
|
|
},
|
2024-08-05 15:30:17 +05:30
|
|
|
// webpack: (config, { isServer }) => {
|
|
|
|
|
// if (!isServer) {
|
|
|
|
|
// // Ensure that all imports of 'yjs' resolve to the same instance
|
|
|
|
|
// config.resolve.alias["yjs"] = path.resolve(__dirname, "node_modules/yjs");
|
|
|
|
|
// }
|
|
|
|
|
// return config;
|
|
|
|
|
// },
|
2024-05-21 13:43:54 +05:30
|
|
|
async redirects() {
|
|
|
|
|
return [
|
|
|
|
|
{
|
|
|
|
|
source: "/accounts/sign-up",
|
2024-05-22 14:49:06 +05:30
|
|
|
destination: "/sign-up",
|
2024-06-10 12:16:23 +05:30
|
|
|
permanent: true,
|
2024-05-22 14:49:06 +05:30
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
source: "/sign-in",
|
2024-05-21 13:43:54 +05:30
|
|
|
destination: "/",
|
2024-06-10 12:16:23 +05:30
|
|
|
permanent: true,
|
2024-05-22 17:31:56 +05:30
|
|
|
},
|
2024-08-05 13:37:11 +05:30
|
|
|
{
|
|
|
|
|
source: "/signin",
|
|
|
|
|
destination: "/",
|
|
|
|
|
permanent: true,
|
|
|
|
|
},
|
2024-05-22 17:31:56 +05:30
|
|
|
{
|
|
|
|
|
source: "/register",
|
|
|
|
|
destination: "/sign-up",
|
2024-06-10 12:16:23 +05:30
|
|
|
permanent: true,
|
2024-05-22 17:31:56 +05:30
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
source: "/login",
|
|
|
|
|
destination: "/",
|
2024-06-10 12:16:23 +05:30
|
|
|
permanent: true,
|
|
|
|
|
},
|
|
|
|
|
];
|
2024-05-21 13:43:54 +05:30
|
|
|
},
|
2024-04-06 17:13:24 +05:30
|
|
|
async rewrites() {
|
2024-08-01 21:08:57 +05:30
|
|
|
const posthogHost = process.env.NEXT_PUBLIC_POSTHOG_HOST || "https://app.posthog.com";
|
2024-10-11 20:13:38 +05:30
|
|
|
const uploadsBaseURL = process.env.NEXT_PUBLIC_API_BASE_URL || "";
|
2024-05-10 02:32:42 +05:30
|
|
|
const rewrites = [
|
2024-04-06 17:13:24 +05:30
|
|
|
{
|
|
|
|
|
source: "/ingest/static/:path*",
|
2024-05-28 13:08:37 +05:30
|
|
|
destination: `${posthogHost}/static/:path*`,
|
2024-04-06 17:13:24 +05:30
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
source: "/ingest/:path*",
|
2024-05-28 13:08:37 +05:30
|
|
|
destination: `${posthogHost}/:path*`,
|
2024-04-06 17:13:24 +05:30
|
|
|
},
|
2024-05-08 23:01:20 +05:30
|
|
|
];
|
2024-05-10 02:32:42 +05:30
|
|
|
if (process.env.NEXT_PUBLIC_ADMIN_BASE_URL || process.env.NEXT_PUBLIC_ADMIN_BASE_PATH) {
|
2024-06-10 12:16:23 +05:30
|
|
|
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 20:04:00 +05:30
|
|
|
rewrites.push({
|
|
|
|
|
source: "/god-mode",
|
|
|
|
|
destination: `${GOD_MODE_BASE_URL}/`,
|
2024-08-01 21:08:57 +05:30
|
|
|
});
|
2024-05-10 02:32:42 +05:30
|
|
|
rewrites.push({
|
|
|
|
|
source: "/god-mode/:path*",
|
|
|
|
|
destination: `${GOD_MODE_BASE_URL}/:path*`,
|
2024-06-10 12:16:23 +05:30
|
|
|
});
|
2024-05-10 02:32:42 +05:30
|
|
|
}
|
|
|
|
|
return rewrites;
|
2024-05-08 23:01:20 +05:30
|
|
|
},
|
2022-11-19 19:51:26 +05:30
|
|
|
};
|
|
|
|
|
|
2024-05-27 15:02:03 +05:30
|
|
|
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,
|
2024-08-01 21:08:57 +05:30
|
|
|
};
|
2024-05-27 15:02:03 +05:30
|
|
|
|
|
|
|
|
if (parseInt(process.env.SENTRY_MONITORING_ENABLED || "0", 10)) {
|
2024-08-21 17:54:13 +05:30
|
|
|
module.exports = withSentryConfig(nextConfig, sentryConfig);
|
2023-02-08 20:44:35 +05:30
|
|
|
} else {
|
2024-08-21 17:54:13 +05:30
|
|
|
module.exports = nextConfig;
|
2023-02-08 20:44:35 +05:30
|
|
|
}
|