-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnext.config.js
40 lines (33 loc) · 1.19 KB
/
next.config.js
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
const isGithubActions = process.env.GITHUB_ACTIONS || false;
const assetPrefix = isGithubActions ? "https://nekevss.github.io/boa-debugger" : undefined;
/** @type {import('next').NextConfig} */
const nextConfig = {
output: "export",
reactStrictMode: true,
assetPrefix: assetPrefix,
webpack: function(config, { isServer }) {
patchWasmModuleImport(config, isServer)
return config
}
}
// Courtesy of the below issue (most recent post by iksent).
//
// This may fail in future builds as this config seems to be both dependent on Webpack,
// and however Next.js/Vercel wants the webpack config.
function patchWasmModuleImport(config, isServer) {
config.experiments = Object.assign(config.experiments || {}, {
asyncWebAssembly: true,
});
config.optimization.moduleIds = 'named';
config.module.rules.push({
test: /\.wasm$/,
type: 'webassembly/async',
});
// TODO: improve this function -> track https://github.com/vercel/next.js/issues/25852
if (isServer) {
config.output.webassemblyModuleFilename = './../static/wasm/[modulehash].wasm';
} else {
config.output.webassemblyModuleFilename = 'static/wasm/[modulehash].wasm';
}
}
module.exports = nextConfig