-
Notifications
You must be signed in to change notification settings - Fork 0
/
next.config.mjs
145 lines (135 loc) · 3.43 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
/** @type {import('next').NextConfig} */
import createWithBundleAnalyzer from '@next/bundle-analyzer';
import createWithMdx from '@next/mdx';
import { withSentryConfig } from '@sentry/nextjs';
import { h } from 'hastscript';
import rehypePrettyCode from 'rehype-pretty-code';
import rehypeSlug from 'rehype-slug';
import rehypeToc from 'rehype-toc';
import remarkGfm from 'remark-gfm';
const withBundleAnalyzer = createWithBundleAnalyzer({
enabled: process.env.ANALYZE === 'true',
openAnalyzer:
process.env.ANALYZE === 'true' && process.env.OPEN_ANALYZER === 'true',
});
function rehypeWrapMainContent() {
return (tree) => {
let navNode;
const nonNavNodes = tree.children?.filter((node) => {
if (node.type === 'element' && node.tagName === 'TocNav') {
navNode = node;
return false;
}
return true;
});
if (navNode) {
tree.children = [
h('div.docs-main-contents', h('prose', nonNavNodes)),
h('div.docs-toc', navNode),
];
}
return tree;
};
}
const withMDX = createWithMdx({
options: {
remarkPlugins: [remarkGfm],
rehypePlugins: [
rehypeSlug,
[
rehypeToc,
{
headings: ['h2', 'h3'],
customizeTOC: (toc) => {
// change element from nav to TOCNav
// We need this to be able to render a custom component in mdx-components
// to replace the `a` tags with `Link` components
toc.tagName = 'TocNav';
return toc;
},
},
],
rehypeWrapMainContent,
[
rehypePrettyCode,
{
theme: 'one-dark-pro',
},
],
],
},
});
const nextConfig = {
experimental: {
serverActions: {
bodySizeLimit: "10mb"
}
},
pageExtensions: ['js', 'jsx', 'ts', 'tsx', 'md', 'mdx'],
images: {
domains: ['localhost'],
remotePatterns: [
{
protocol: 'https',
hostname: '*.supabase.co',
port: '',
pathname: '/**',
},
{
protocol: 'https',
hostname: '*.supabase.com',
port: '',
pathname: '/**',
},
{
protocol: 'https',
hostname: '*.gravatar.com',
port: '',
pathname: '/**',
},
{
protocol: 'https',
hostname: 'images.unsplash.com',
port: '',
pathname: '/**',
},
{
protocol: 'https',
hostname: 'github.com',
port: '',
pathname: '/**',
},
{
protocol: 'https',
hostname: 'oaidalleapiprodscus.blob.core.windows.net',
port: '',
pathname: '/**',
},
],
},
reactStrictMode: true,
// webpack: (config) => {
// if (typeof nextRuntime === 'undefined') {
// config.resolve.fallback = {
// ...config.resolve.fallback,
// fs: false,
// };
// }
// return config;
// },
sentry: {
// Use `hidden-source-map` rather than `source-map` as the Webpack `devtool`
// for client-side builds. (This will be the default starting in
// `@sentry/nextjs` version 8.0.0.) See
// https://webpack.js.org/configuration/devtool/ and
// https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/#use-hidden-source-map
// for more information.
hideSourceMaps: true,
},
logging: {
fetches: {
fullUrl: true,
},
},
};
export default withBundleAnalyzer(withSentryConfig(withMDX(nextConfig)));