-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathnext.config.mjs
More file actions
44 lines (37 loc) · 1.14 KB
/
next.config.mjs
File metadata and controls
44 lines (37 loc) · 1.14 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
import nextra from "nextra"
import NodePolyfillPlugin from "node-polyfill-webpack-plugin"
/** @type {import('next').NextConfig} */
const nextConfig = {
output: "export",
distDir: "dist",
reactStrictMode: true,
images: {
unoptimized: true,
},
webpack: (config) => {
config.experiments = {...config.experiments, syncWebAssembly: true}
/**
* Webpack doesn't support `node:` prefixed imports, so rewrite them to be
* plain imports, allowing the NodePolyfillPlugin to do its job correctly.
*/
config.plugins.push({
apply(compiler) {
compiler.hooks.normalModuleFactory.tap("RewriteNodeProtocol", (nmf) => {
nmf.hooks.beforeResolve.tap("RewriteNodeProtocol", (result) => {
if (result?.request?.startsWith("node:")) {
result.request = result.request.replace(/^node:/, "")
}
})
})
},
})
config.plugins.push(new NodePolyfillPlugin())
config.module.rules.push({
test: /@biomejs\/wasm-nodejs/i,
use: "null-loader",
})
return config
},
}
const withNextra = nextra({})
export default withNextra(nextConfig)