mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-04-25 08:46:22 +02:00
90 lines
2.3 KiB
TypeScript
90 lines
2.3 KiB
TypeScript
import { createMDX } from "fumadocs-mdx/next";
|
|
import type { NextConfig } from "next";
|
|
import createNextIntlPlugin from "next-intl/plugin";
|
|
|
|
// Create the next-intl plugin
|
|
const withNextIntl = createNextIntlPlugin("./i18n/request.ts");
|
|
|
|
const nextConfig: NextConfig = {
|
|
output: "standalone",
|
|
// Disable StrictMode for BlockNote compatibility with React 19/Next 15
|
|
reactStrictMode: false,
|
|
typescript: {
|
|
ignoreBuildErrors: true,
|
|
},
|
|
images: {
|
|
remotePatterns: [
|
|
{
|
|
protocol: "https",
|
|
hostname: "**",
|
|
},
|
|
],
|
|
},
|
|
// Mark BlockNote server packages as external
|
|
serverExternalPackages: ["@blocknote/server-util"],
|
|
|
|
// Turbopack config (used during `next dev --turbopack`)
|
|
turbopack: {
|
|
rules: {
|
|
"*.svg": {
|
|
loaders: ["@svgr/webpack"],
|
|
as: "*.js",
|
|
},
|
|
},
|
|
},
|
|
|
|
// Configure webpack to handle blocknote packages + SVGR
|
|
webpack: (config, { isServer }) => {
|
|
if (isServer) {
|
|
// Don't bundle these packages on the server
|
|
config.externals = [...(config.externals || []), "@blocknote/server-util"];
|
|
}
|
|
|
|
// SVGR: import *.svg as React components
|
|
const fileLoaderRule = config.module.rules.find((rule: any) => rule.test?.test?.(".svg"));
|
|
config.module.rules.push(
|
|
// Re-apply the existing file loader for *.svg?url imports
|
|
{
|
|
...fileLoaderRule,
|
|
test: /\.svg$/i,
|
|
resourceQuery: /url/, // e.g. import icon from './icon.svg?url'
|
|
},
|
|
// Convert all other *.svg imports to React components
|
|
{
|
|
test: /\.svg$/i,
|
|
issuer: fileLoaderRule.issuer,
|
|
resourceQuery: { not: [...fileLoaderRule.resourceQuery.not, /url/] },
|
|
use: ["@svgr/webpack"],
|
|
}
|
|
);
|
|
fileLoaderRule.exclude = /\.svg$/i;
|
|
|
|
return config;
|
|
},
|
|
|
|
// PostHog reverse proxy configuration
|
|
// This helps bypass ad blockers by routing requests through your domain
|
|
async rewrites() {
|
|
return [
|
|
{
|
|
source: "/ingest/static/:path*",
|
|
destination: "https://us-assets.i.posthog.com/static/:path*",
|
|
},
|
|
{
|
|
source: "/ingest/:path*",
|
|
destination: "https://us.i.posthog.com/:path*",
|
|
},
|
|
{
|
|
source: "/ingest/decide",
|
|
destination: "https://us.i.posthog.com/decide",
|
|
},
|
|
];
|
|
},
|
|
// Required for PostHog reverse proxy to work correctly
|
|
skipTrailingSlashRedirect: true,
|
|
};
|
|
|
|
// Wrap the config with MDX and next-intl plugins
|
|
const withMDX = createMDX({});
|
|
|
|
export default withNextIntl(withMDX(nextConfig));
|