-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnext.config.mjs
More file actions
167 lines (156 loc) · 3.99 KB
/
next.config.mjs
File metadata and controls
167 lines (156 loc) · 3.99 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
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 path from "node:path";
import { fileURLToPath } from "node:url";
import bundleAnalyzer from "@next/bundle-analyzer";
import mdx from "@next/mdx";
/** @type {import('codehike/mdx').CodeHikeConfig} */
const chConfig = {
components: {
code: "Code",
},
};
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const remarkCodeHikePluginPath = path.join(
__dirname,
"mdx-plugins/remark-codehike.mjs",
);
/** @type {import('next').NextConfig} */
const config = {
/** mdxRS 로 하면 `remarkPlugins` 가 먹히지 않음. */
// experimental: {
// mdxRs: true,
// },
reactStrictMode: true,
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: [
["@echoja/remark-custom-container", customContainerOptions],
"remark-gfm",
[remarkCodeHikePluginPath, chConfig],
["remark-toc", { heading: "목차|Table of Contents" }],
],
rehypePlugins: [
"rehype-slug",
[
"rehype-autolink-headings",
{
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",
},
},
],
},
},
],
"@hbsnow/rehype-sectionize",
],
},
});
export default withMDX(withBundleAnalyzer(config));