-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathnext.config.js
More file actions
79 lines (70 loc) · 1.58 KB
/
Copy pathnext.config.js
File metadata and controls
79 lines (70 loc) · 1.58 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
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
const nextra = require('nextra').default
const withNextra = nextra({
latex: true,
defaultShowCopyCode: true,
search: true,
// staticImage: true,
codeHighlight: true,
// theme: 'nextra-theme-docs',
// themeConfig: './theme.config.jsx'
})
/** @type {import('next').NextConfig} */
const nextConfig = {
output: 'export',
reactStrictMode: true,
images: {
unoptimized: true
},
turbopack: {
resolveAlias: {
'next-mdx-import-source-file': './src/mdx-components.ts'
}
},
webpack: (config, { isServer, webpack }) => {
// fixes npm packages that depend on `fs` module
if (!isServer) {
config.resolve.fallback.fs = false
}
config.plugins.push(
new webpack.DefinePlugin({
'__CLIENT__': !isServer,
'__SERVER__': isServer,
})
)
config.module.rules.push({
test: /\.(pdf)$/,
type: 'asset/resource',
});
config.module.rules.push(
{
test: /\.svg$/i,
// type: 'asset/resource',
resourceQuery: /url/, // *.svg?url
use: [
{
loader: 'next-image-loader',
options: {
assetPrefix: ''
}
}
]
},
{
test: /\.svg$/i,
issuer: /\.[jt]sx?$/,
resourceQuery: { not: [/url/] }, // exclude if import * from "*.svg?url"
use: [
{
loader: '@svgr/webpack',
options: {
dimensions: false
}
}
]
}
)
return config
}
}
const config = withNextra(nextConfig)
module.exports = config