-
Notifications
You must be signed in to change notification settings - Fork 422
Expand file tree
/
Copy pathnext.config.mjs
More file actions
40 lines (36 loc) · 1.13 KB
/
next.config.mjs
File metadata and controls
40 lines (36 loc) · 1.13 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
import nextra from 'nextra'
import remarkMath from 'remark-math'
import rehypeKatex from 'rehype-katex'
import remarkReplaceVariables from './plugins/remark-replace-variables.mjs'
// Set up Nextra with its configuration
const withNextra = nextra({
defaultShowCopyCode: true,
mdxOptions: {
remarkPlugins: [remarkReplaceVariables, remarkMath],
rehypePlugins: [rehypeKatex],
},
})
// Follow VitePress pattern: use BASE environment variable with trailing slash
const { BASE: base = "" } = process.env;
const basePath = base ? base.replace(/\/$/, '') : undefined; // Remove trailing slash for Next.js
// Export the final Next.js config with Nextra included
export default withNextra({
// Add regular Next.js options here
basePath: basePath,
assetPrefix: base || undefined, // Keep trailing slash for assets
output: 'export',
trailingSlash: true,
images: {
unoptimized: true,
},
experimental: {
// mdxRs is disabled because it doesn't support custom remark plugins
},
webpack: (config) => {
config.watchOptions = {
...config.watchOptions,
ignored: ['**/node_modules/**']
}
return config
}
})