-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnext.config.mjs
65 lines (62 loc) · 2.06 KB
/
next.config.mjs
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
import rehypeShiki from "@mskelton/rehype-shiki"
import remarkExtractFrontmatter from "@mskelton/remark-extract-frontmatter"
import nextMDX from "@next/mdx"
import rehypeSlug from "rehype-slug"
import remarkFrontmatter from "remark-frontmatter"
import remarkGfm from "remark-gfm"
import remarkMdxFrontmatter from "remark-mdx-frontmatter"
import remarkSmartypants from "remark-smartypants"
import { getHighlighter } from "shiki"
import { langAlias, langs, themeMap, themes } from "./config/highlighter.mjs"
import { redirects, rewrites } from "./config/redirects.mjs"
import rehypeCallout from "./config/rehype-callout.mjs"
import rehypeCodeMeta from "./config/rehype-code-meta.mjs"
import rehypeCodeTitles from "./config/rehype-code-titles.mjs"
import rehypeHeaderId from "./config/rehype-header-id.mjs"
import rehypeHeadings from "./config/rehype-headings.mjs"
import rehypeParseCodeMeta from "./config/rehype-parse-code-meta.mjs"
import remarkAutoImagePath from "./config/remark-auto-image-path.mjs"
import remarkCodeBlock from "./config/remark-code-block.mjs"
/** @type {import("next").NextConfig} */
const nextConfig = {
eslint: {
dirs: ["app", "components", "config", "e2e"],
},
experimental: {
instrumentationHook: true,
},
images: {
minimumCacheTTL: 3600, // 1 hour
},
output: "standalone",
pageExtensions: ["ts", "tsx", "md", "mdx"],
reactStrictMode: true,
redirects: async () => redirects,
rewrites: async () => rewrites,
}
const highlighter = await getHighlighter({ langAlias, langs, themes })
const withMDX = nextMDX({
extension: /\.mdx?$/,
options: {
rehypePlugins: [
rehypeSlug,
rehypeHeadings,
rehypeHeaderId,
rehypeParseCodeMeta,
[rehypeShiki, { highlighter, themes: themeMap }],
rehypeCodeTitles,
rehypeCodeMeta,
rehypeCallout,
],
remarkPlugins: [
remarkGfm,
remarkSmartypants,
remarkExtractFrontmatter,
remarkFrontmatter,
[remarkMdxFrontmatter, { name: "meta" }],
remarkAutoImagePath,
remarkCodeBlock,
],
},
})
export default withMDX(nextConfig)