-
Notifications
You must be signed in to change notification settings - Fork 8
/
next.config.mjs
70 lines (67 loc) · 1.88 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
import path from 'path';
import createMDX from '@next/mdx';
import remarkGFM from 'remark-gfm';
import remarkFrontmatter from 'remark-frontmatter';
import remarkMdxFrontmatter from 'remark-mdx-frontmatter';
import remarkMdxImages from 'remark-mdx-images';
import remarkCodeSandbox from 'remark-codesandbox';
import remarkMdxExcerpt from './src/internals/remarkMdxExcerpt.js';
import rehypeCodeBlockMeta from './src/internals/rehypeCodeBlockMeta.js';
const withMDX = createMDX({
options: {
remarkPlugins: [
remarkGFM,
remarkFrontmatter,
[remarkMdxFrontmatter, { name: 'frontmatter' }],
remarkMdxExcerpt,
remarkMdxImages,
[
remarkCodeSandbox,
{
mode: 'meta',
customTemplates: {
'observe-selector': {
extends: `file:${path.resolve(
process.cwd(),
'src/posts/One-fun-trick-to-observe-elements-in-realtime-without-MutationObserver/observe-selector',
)}`,
entry: 'src/index.js',
},
},
autoDeploy: process.env.NODE_ENV === 'production',
},
],
],
rehypePlugins: [rehypeCodeBlockMeta],
},
});
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
pageExtensions: ['ts', 'tsx', 'js', 'jsx', 'md', 'mdx'],
redirects() {
return [
{
source: '/posts',
destination: '/',
permanent: false,
},
{
source: '/blog/:slug*',
destination: '/posts/:slug*',
permanent: false,
},
{
source: '/BeanfunLogin',
destination: 'https://kevin940726.github.io/BeanfunLogin',
permanent: true,
},
{
source: '/minesweeper',
destination: 'https://kevin940726.github.io/minesweeper',
permanent: true,
},
];
},
};
export default withMDX(nextConfig);