-
Notifications
You must be signed in to change notification settings - Fork 2
/
next.config.js
46 lines (38 loc) · 1.06 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
const { readFileSync } = require("fs");
const redirectsFile = readFileSync("redirects.txt", "utf-8")
.toString()
.trim()
.split("\n");
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: false,
analyticsId: process.env.VERCEL_ANALYTICS_ID,
redirects() {
const redirects = redirectsFile.map((args) => {
const [source, destination, permanent] = args.split(" ");
return {
source,
destination,
permanent: Boolean(permanent),
};
});
for (const redirect of redirects) {
if (!redirect.source.endsWith("/") && redirect.source.startsWith("/"))
redirects.push({
...redirect,
source: `${redirect.source}/`,
});
}
return redirects;
},
};
/** @type {import('nextra').NextraConfig} */
const nextraConfig = {
theme: "@components/layout",
themeConfig: "./theme.config.tsx",
staticImage: true,
defaultShowCopyCode: true,
readingTime: true,
};
const withNextra = require("nextra")(nextraConfig);
module.exports = withNextra(nextConfig);