-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnext.config.mjs
More file actions
52 lines (47 loc) · 1.15 KB
/
next.config.mjs
File metadata and controls
52 lines (47 loc) · 1.15 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
import nextMDX from "@next/mdx";
import { execSync } from "child_process";
import { recmaPlugins } from "./src/mdx/recma.mjs";
import { rehypePlugins } from "./src/mdx/rehype.mjs";
import { remarkPlugins } from "./src/mdx/remark.mjs";
import withSearch from "./src/mdx/search.mjs";
// Get git SHA at build time
const getGitSHA = () => {
try {
return execSync("git rev-parse --short HEAD").toString().trim();
} catch {
return "unknown";
}
};
const withMDX = nextMDX({
// TODO: Turbopack doesn't support custom plugins
// so we're using webpack instead
options: {
remarkPlugins,
rehypePlugins,
recmaPlugins,
},
});
/** @type {import('next').NextConfig} */
const nextConfig = {
pageExtensions: ["js", "jsx", "ts", "tsx", "mdx"],
outputFileTracingIncludes: {
"/**/*": ["./src/app/**/*.mdx"],
},
env: {
NEXT_PUBLIC_GIT_SHA: getGitSHA(),
},
async headers() {
return [
{
source: "/og/:path*",
headers: [
{
key: "Cache-Control",
value: "public, max-age=31536000, immutable",
},
],
},
];
},
};
export default withSearch(withMDX(nextConfig));