-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnext.config.mjs
104 lines (96 loc) · 2.46 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
import nextMDX from '@next/mdx';
import remarkGfm from 'remark-gfm';
import rehypePrism from '@mapbox/rehype-prism';
import analyzer from '@next/bundle-analyzer';
/** @type {import('next').NextConfig} */
const nextConfig = {
pageExtensions: ['js', 'jsx', 'mdx', 'tsx', 'ts', 'jsx', 'js'],
reactStrictMode: true,
experimental: {
scrollRestoration: true,
// mdxRs: true,
},
async rewrites() {
return [
{
source: '/stats/js/script.js',
destination: 'https://plausible.io/js/script.js',
},
{
source: '/stats/api/event',
destination: 'https://plausible.io/api/event',
},
];
},
async redirects() {
return [
// # redirect search to duckduckgo
{
permanent: true,
source: '/thoughts/feed',
destination: '/thoughts/feed.rss',
},
{
permanent: true,
source: '/search',
destination: 'https://duckduckgo.com/?q=:term+site%3Adtott.com',
has: [
{
type: 'query',
key: 'term',
value: '(?<term>.*)',
},
],
},
{
permanent: true,
source: '/thoughts/search',
destination: '/thoughts',
},
{
permanent: true,
source: '/thoughts/:year/:month/:date/:slug',
destination: '/thoughts/:slug-:year-:month-:date',
// # Fix up some whoopsies
},
{
permanent: true,
source: '/thoughts/styling-react-components-talk',
destination: '/thoughts/2020/02/12/styling-react-components-talk',
},
{
permanent: true,
source: '/thoughts/2007/09/10/css-tips-1-use-a-reset',
destination: '/thoughts/2007/09/10/css-tip-1-use-a-reset',
},
{
source: '/thoughts/2007/09/10/css-tips-1-use-a-reset',
destination: '/thoughts/2007/09/10/css-tip-1-use-a-reset',
permanent: true,
},
{
source: '/index.php',
has: [
{
type: 'query',
key: 'p',
value: '(?<p>.*)',
},
],
destination: '/:p',
permanent: true,
},
];
},
};
const withMDX = nextMDX({
extension: /\.mdx?$/,
options: {
remarkPlugins: [remarkGfm],
rehypePlugins: [[rehypePrism, { ignoreMissing: true }]],
},
});
const withBundleAnalyzer = analyzer({
enabled: process.env.BUNDLE_ANALYZE === 'true',
});
export default withBundleAnalyzer(withMDX(nextConfig));