forked from zeta-chain/docs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnext.config.js
More file actions
97 lines (86 loc) · 2.59 KB
/
next.config.js
File metadata and controls
97 lines (86 loc) · 2.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
/* eslint-disable no-process-env */
const withBundleAnalyzer = require("@next/bundle-analyzer")({
enabled: process.env.ANALYZE === "true",
});
/** @type {import('nextra').NextraConfig} */
const nextraConfig = {
theme: "nextra-theme-docs",
themeConfig: "./src/theme.config.tsx",
latex: true,
defaultShowCopyCode: true,
};
const withNextra = require("nextra")(nextraConfig);
const { nextHeadersConfig } = require("./src/config/headers.config.json");
/** @type {import('next').NextConfig} */
const baseNextConfig = {
reactStrictMode: true,
transpilePackages: ["@zetachain/ui-toolkit"],
experimental: {
externalDir: true,
/**
* Generating source maps consumes extra memory during the build process.
* https://nextjs.org/docs/app/building-your-application/optimizing/memory-usage#disable-source-maps
*/
serverSourceMaps: false,
},
trailingSlash: true,
basePath: process.env.NEXT_PUBLIC_BASE_PATH,
// This is required to support PostHog trailing slash API requests
skipTrailingSlashRedirect: true,
// Rewrites to proxy PostHog ingestion endpoints
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*",
},
];
},
/**
* Generating source maps consumes extra memory during the build process.
* https://nextjs.org/docs/app/building-your-application/optimizing/memory-usage#disable-source-maps
*/
productionBrowserSourceMaps: false,
images: {
dangerouslyAllowSVG: false,
remotePatterns: [
{
protocol: "https",
hostname: "images.ctfassets.net", // contentful images
port: "",
pathname: "/jmvpciyouqsr/**", // production space id
},
{
protocol: "http",
hostname: "localhost",
port: "3001",
pathname: "/**",
},
],
},
headers: async () => nextHeadersConfig,
webpack(config) {
// eslint-disable-next-line no-param-reassign
config.resolve.fallback = {
...config.resolve.fallback,
fs: false,
path: false,
};
config.module.rules.push({
test: /\.svg$/,
use: ["@svgr/webpack"],
});
return config;
},
};
// Run next build with EXPORT env var set to make a static build compatible with linkinator
if (process.env.EXPORT) {
baseNextConfig.images = { unoptimized: true };
baseNextConfig.output = "export";
}
const configWithNextra = withNextra(baseNextConfig);
module.exports = withBundleAnalyzer(configWithNextra);