-
Notifications
You must be signed in to change notification settings - Fork 61
/
next.config.js
63 lines (54 loc) · 1.79 KB
/
next.config.js
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
/* 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,
/**
* 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,
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);