-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnext.config.mjs
63 lines (58 loc) · 1.56 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
import path from 'node:path'
import nextra from 'nextra'
const withNextra = nextra({
theme: 'nextra-theme-docs',
themeConfig: './theme.config.tsx',
latex: true,
search: {
codeblocks: false
},
defaultShowCopyCode: true
})
const sep = path.sep === '/' ? '/' : '\\\\'
const ALLOWED_SVG_REGEX = new RegExp(`components${sep}icons${sep}.+\\.svg$`)
export default withNextra({
// output: "export",
images: {
unoptimized: true, // 禁用图片优化(GitHub Pages 不支持)
// loader: "custom",
// imageSizes: [16, 32, 48, 64, 96, 128, 256, 384],
// deviceSizes: [640, 750, 828, 1080, 1200, 1920, 2048, 3840],
},
reactStrictMode: true,
eslint: {
// ESLint behaves weirdly in this monorepo.
ignoreDuringBuilds: true
},
redirects: () => [
{
source: '/docs/guide/:slug(typescript|latex|tailwind-css|mermaid)',
destination: '/docs/guide/advanced/:slug',
permanent: true
},
{
source: '/docs/docs-theme/built-ins/:slug(callout|steps|tabs)',
destination: '/docs/guide/built-ins/:slug',
permanent: true
},
{
source: '/docs/docs-theme/api/use-config',
destination: '/docs/docs-theme/api',
permanent: true
}
],
webpack(config) {
const fileLoaderRule = config.module.rules.find(rule =>
rule.test?.test?.('.svg')
)
fileLoaderRule.exclude = ALLOWED_SVG_REGEX
config.module.rules.push({
test: ALLOWED_SVG_REGEX,
use: ['@svgr/webpack']
})
return config
},
experimental: {
optimizePackageImports: ['@components/icons']
}
})