mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-04-25 08:46:22 +02:00
77 lines
1.9 KiB
TypeScript
77 lines
1.9 KiB
TypeScript
import path from "node:path";
|
|
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");
|
|
|
|
// 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.
|
|
const nextConfig: NextConfig = {
|
|
output: "standalone",
|
|
outputFileTracingRoot: path.join(__dirname, ".."),
|
|
reactStrictMode: false,
|
|
typescript: {
|
|
ignoreBuildErrors: true,
|
|
},
|
|
images: {
|
|
remotePatterns: [
|
|
{
|
|
protocol: "https",
|
|
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
|
|
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"],
|
|
}
|
|
);
|
|
fileLoaderRule.exclude = /\.svg$/i;
|
|
|
|
return config;
|
|
},
|
|
};
|
|
|
|
// Wrap the config with MDX and next-intl plugins
|
|
const withMDX = createMDX({});
|
|
|
|
export default withNextIntl(withMDX(nextConfig));
|