-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnext.config.mjs
167 lines (157 loc) · 3.99 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
import remarkCustomContainer from "@echoja/remark-custom-container";
import bundleAnalyzer from "@next/bundle-analyzer";
import mdx from "@next/mdx";
import { remarkCodeHike } from "codehike/mdx";
import rehypeAutolinkHeadings from "rehype-autolink-headings";
import rehypeSlug from "rehype-slug";
import remarkGfm from "remark-gfm";
import remarkToc from "remark-toc";
/** @type {import('codehike/mdx').CodeHikeConfig} */
const chConfig = {
components: {
code: "Code",
},
};
/** @type {import('next').NextConfig} */
const config = {
/** mdxRS 로 하면 `remarkPlugins` 가 먹히지 않음. */
// experimental: {
// mdxRs: true,
// },
reactStrictMode: true,
eslint: {
dirs: ["src"],
},
images: {
remotePatterns: [
{
hostname: "s3.ap-northeast-2.amazonaws.com",
},
],
},
async redirects() {
return [
{
source: "/post/12",
destination: "/article/2023-03/draw-io-auto-layout",
permanent: true,
},
{
source: "/post/11",
destination: "/article/2023-02/knou-tips",
permanent: true,
},
{
source: "/post/10",
destination: "/article/2023-02/puss-in-boots",
permanent: true,
},
{
source: "/post/9",
destination: "/article/2022-11/i-me-mom-mom",
permanent: true,
},
{
source: "/post/7",
destination: "/article/2022-11/easy-promise-async-await",
permanent: true,
},
{
source: "/post/5",
destination: "/article/2022-10/javascript-smooth-animation",
permanent: true,
},
{
source: "/post/6",
destination: "/article/2022-11/everything",
permanent: true,
},
{
source: "/post/3",
destination: "/article/2023-07/ts-data-structure",
permanent: true,
},
{
source: "/post/2",
destination: "/article/2022-10/hello-sadness",
permanent: true,
},
{
source: "/post/1",
destination: "/article/2022-09/company",
permanent: true,
},
];
},
pageExtensions: ["ts", "tsx", "js", "jsx", "md", "mdx"],
};
const withBundleAnalyzer = bundleAnalyzer({
enabled: process.env.ANALYZE === "true",
});
/** @type {import("@echoja/remark-custom-container").CustomContainerOptions } */
const customContainerOptions = {
optionsByClassName: [
{
selector: "details",
containerTag: "details",
titleTag: "summary",
},
],
};
const withMDX = mdx({
options: {
jsx: true,
remarkPlugins: [
[remarkCustomContainer, customContainerOptions],
remarkGfm,
[remarkCodeHike, chConfig],
[remarkToc, { heading: "목차" }],
],
rehypePlugins: [
rehypeSlug,
[
rehypeAutolinkHeadings,
{
properties: {
ariaHidden: true,
tabIndex: -1,
className: "heading-anchor",
},
content: {
type: "element",
tagName: "svg",
properties: {
className: "icon-link",
xmlns: "http://www.w3.org/2000/svg",
width: "24",
height: "24",
viewBox: "0 0 24 24",
fill: "none",
stroke: "currentColor",
"stroke-width": "2",
"stroke-linecap": "round",
"stroke-linejoin": "round",
},
children: [
{
type: "element",
tagName: "path",
properties: {
d: "M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",
},
},
{
type: "element",
tagName: "path",
properties: {
d: "M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",
},
},
],
},
},
],
],
},
});
export default withMDX(withBundleAnalyzer(config));