Download frontend/next.config.ts from new-arc/vector: direct link, hf CLI and curl.
- Browser
- Download file 2.47 kB
-
https://huggingface.co/spaces/new-arc/vector/resolve/main/frontend/next.config.ts
- Command line
-
hf download hf://spaces/new-arc/vector/frontend/next.config.ts
-
curl -L -o next.config.ts https://huggingface.co/spaces/new-arc/vector/resolve/main/frontend/next.config.ts
2.47 kB
| import type { NextConfig } from "next"; | |
| import createNextIntlPlugin from "next-intl/plugin"; | |
| import { withPostHogConfig } from "@posthog/nextjs-config"; | |
| const withNextIntl = createNextIntlPlugin("./src/i18n/request.ts"); | |
| const isPostHogEnabled = Boolean(process.env.NEXT_PUBLIC_POSTHOG_KEY?.trim()); | |
| const posthogHost = (process.env.NEXT_PUBLIC_POSTHOG_HOST?.trim() || "https://eu.i.posthog.com").replace(/\/$/, ""); | |
| // PostHog Cloud serves the SDK bundles from a separate assets host. | |
| const posthogAssetsHost = posthogHost.replace(/^https:\/\/(us|eu)\.i\.posthog\.com$/, "https://$1-assets.i.posthog.com"); | |
| // Same-origin reverse proxy so ad blockers don't drop analytics, replays, and error reports. | |
| const posthogRewrites = isPostHogEnabled | |
| ? [ | |
| { source: "/ingest/static/:path*", destination: `${posthogAssetsHost}/static/:path*` }, | |
| { source: "/ingest/array/:path*", destination: `${posthogAssetsHost}/array/:path*` }, | |
| { source: "/ingest/:path*", destination: `${posthogHost}/:path*` }, | |
| ] | |
| : []; | |
| const nextConfig: NextConfig = { | |
| distDir: process.env.NEXT_BUILD_DIR || ".next", | |
| output: 'standalone', | |
| // Keep canonical tags in the initial <head>, including for Googlebot. | |
| htmlLimitedBots: /.*/, | |
| // PostHog's API paths end in a slash (e.g. /e/); don't redirect them. | |
| skipTrailingSlashRedirect: isPostHogEnabled, | |
| typescript: { | |
| ignoreBuildErrors: false, | |
| }, | |
| async rewrites() { | |
| return [ | |
| { | |
| source: "/js/script.js", | |
| destination: "https://datafa.st/js/script.js", | |
| }, | |
| { | |
| source: "/api/events", | |
| destination: "https://datafa.st/api/events", | |
| }, | |
| ...posthogRewrites, | |
| ]; | |
| }, | |
| }; | |
| const intlConfig = withNextIntl(nextConfig); | |
| // Source maps upload only when a build has PostHog credentials; other builds are unchanged. | |
| const posthogPersonalApiKey = process.env.POSTHOG_PERSONAL_API_KEY?.trim(); | |
| const posthogProjectId = process.env.POSTHOG_PROJECT_ID?.trim(); | |
| export default posthogPersonalApiKey && posthogProjectId | |
| ? withPostHogConfig(intlConfig, { | |
| personalApiKey: posthogPersonalApiKey, | |
| projectId: posthogProjectId, | |
| host: posthogHost.replace(/^https:\/\/(us|eu)\.i\.posthog\.com$/, "https://$1.posthog.com"), | |
| sourcemaps: { | |
| enabled: true, | |
| releaseName: "supoclip-web", | |
| releaseVersion: process.env.POSTHOG_RELEASE_VERSION?.trim() || undefined, | |
| deleteAfterUpload: true, | |
| }, | |
| }) | |
| : intlConfig; | |