sourcebot/packages/web/next.config.mjs
2024-11-18 12:09:26 -08:00

31 lines
988 B
JavaScript

/** @type {import('next').NextConfig} */
const nextConfig = {
output: "standalone",
// @see : https://posthog.com/docs/advanced/proxy/nextjs
async rewrites() {
return [
{
source: "/ingest/static/:path*",
destination: `${process.env.NEXT_PUBLIC_POSTHOG_ASSET_HOST}/static/:path*`,
},
{
source: "/ingest/:path*",
destination: `${process.env.NEXT_PUBLIC_POSTHOG_HOST}/:path*`,
},
{
source: "/ingest/decide",
destination: `${process.env.NEXT_PUBLIC_POSTHOG_HOST}/decide`,
},
];
},
// This is required to support PostHog trailing slash API requests
skipTrailingSlashRedirect: true,
// @note: this is evaluated at build time.
...(process.env.NEXT_PUBLIC_DOMAIN_SUB_PATH ? {
basePath: process.env.NEXT_PUBLIC_DOMAIN_SUB_PATH,
} : {})
};
export default nextConfig;