SurfSense/surfsense_web/next.config.ts

78 lines
1.9 KiB
TypeScript
Raw Normal View History

2026-03-27 03:17:05 -07:00
import path from "node:path";
2025-07-27 10:05:37 -07:00
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");
2025-04-07 23:47:06 -07:00
// TODO: Separate app routes (/login, /dashboard) from marketing routes
// (landing page, /contact, /pricing, /docs) so the desktop build only
// ships what desktop users actually need.
2025-04-07 23:47:06 -07:00
const nextConfig: NextConfig = {
output: "standalone",
outputFileTracingRoot: path.join(__dirname, ".."),
2025-11-23 15:23:31 +05:30
reactStrictMode: false,
2025-07-27 10:05:37 -07:00
typescript: {
ignoreBuildErrors: true,
},
images: {
remotePatterns: [
{
protocol: "https",
2025-08-23 19:40:29 -07:00
hostname: "**",
},
],
},
experimental: {
optimizePackageImports: [
"lucide-react",
"@tabler/icons-react",
"date-fns",
"@assistant-ui/react",
"@assistant-ui/react-markdown",
"motion",
],
},
// Turbopack config (used during `next dev --turbopack`)
turbopack: {
rules: {
"*.svg": {
loaders: ["@svgr/webpack"],
as: "*.js",
},
},
},
// Configure webpack (SVGR)
webpack: (config) => {
// SVGR: import *.svg as React components
2026-03-27 03:17:05 -07:00
const fileLoaderRule = config.module.rules.find(
(rule: { test?: { test?: (s: string) => boolean } }) => 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"],
2026-02-10 19:06:21 +05:30
}
);
fileLoaderRule.exclude = /\.svg$/i;
2025-11-23 15:23:31 +05:30
return config;
},
2025-04-07 23:47:06 -07:00
};
// Wrap the config with MDX and next-intl plugins
2025-04-22 02:24:13 -07:00
const withMDX = createMDX({});
export default withNextIntl(withMDX(nextConfig));