-
-
Notifications
You must be signed in to change notification settings - Fork 158
/
Copy pathnext.config.mjs
61 lines (57 loc) · 1.45 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
import createNextDocsMDX from "next-docs-mdx/config"
import { remarkCodeHike, recmaCodeHike } from "codehike/mdx"
// import fs from "node:fs"
// import { jsx, toJs } from "estree-util-to-js"
// function recmaPlugin() {
// return (tree) => {
// const result = toJs(tree, { handlers: jsx })
// // console.log("```js")
// // console.log(result.value)
// // console.log("```")
// fs.writeFileSync("recma.js", result.value)
// }
// }
/** @type {import('codehike/mdx').CodeHikeConfig} */
const chConfig = {
components: {
code: "Code",
inlineCode: "InlineCode",
},
// ignoreCode: (codeblock) => codeblock.lang === "mermaid",
// syntaxHighlighting: {
// theme: "github-dark",
// },
}
const withMDX = createNextDocsMDX({
mdxOptions: {
remarkPlugins: [[remarkCodeHike, chConfig]],
recmaPlugins: [[recmaCodeHike, chConfig]],
// jsx: true,
},
})
/** @type {import('next').NextConfig} */
const config = {
reactStrictMode: true,
webpack: (config) => {
// fix https://github.com/microsoft/TypeScript-Website/pull/3022
config.module.exprContextCritical = false
return config
},
images: {
remotePatterns: [
{
protocol: "https",
hostname: "github.com",
port: "",
pathname: "/**",
},
{
protocol: "https",
hostname: "avatars.githubusercontent.com",
port: "",
pathname: "/**",
},
],
},
}
export default withMDX(config)