-
Notifications
You must be signed in to change notification settings - Fork 0
/
next.config.mjs
40 lines (37 loc) · 1.13 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
/** @type {import('next').NextConfig} */
import MDX from "@next/mdx"
import remarkFrontmatter from "remark-frontmatter"
import remarkMdxFrontmatter from "./plugins/remark-mdx-frontmatter-nextjs.mjs"
// import remarkMdxCodeMeta from 'remark-mdx-code-meta'
import remarkGfm from "remark-gfm"
import rehypeMetaAsProperties from "./plugins/rehype-mdx-code-meta.mjs"
import fs from "fs"
const withMDX = MDX({
extension: /\.mdx?$/,
options: {
remarkPlugins: [remarkFrontmatter, remarkMdxFrontmatter, remarkGfm],
rehypePlugins: [rehypeMetaAsProperties],
providerImportSource: "@mdx-js/react",
},
})
const nextConfig = {
reactStrictMode: true,
pageExtensions: ["ts", "tsx", "js", "jsx", "md", "mdx"],
images: {
domains: ["images.unsplash.com"],
},
redirects: async () => {
const data = fs.readFileSync("redirects.csv").toLocaleString()
const rows = data.split("\n")
const redirects = rows.map((row) => {
const columns = row.split(",")
return {
source: columns[0],
destination: columns[1],
permanent: false,
}
})
return redirects
},
}
export default withMDX(nextConfig)