-
Notifications
You must be signed in to change notification settings - Fork 8
/
next.config.mjs
59 lines (47 loc) · 1.52 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
import withBundleAnalyzer from '@next/bundle-analyzer';
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: false,
typescript: {
ignoreBuildErrors: true,
},
webpack: (config, { buildId, dev, isServer, defaultLoaders, webpack }) => {
config.module.rules.push({
test: /\.wasm$/,
loader: "base64-loader",
type: "javascript/auto",
});
config.module.rules.push({
test: /\.svg$/,
use: ['@svgr/webpack'],
});
config.module.noParse = /\.wasm$/;
config.module.rules.forEach((rule) => {
(rule.oneOf || []).forEach((oneOf) => {
if (oneOf.loader && oneOf.loader.indexOf("file-loader") >= 0) {
oneOf.exclude.push(/\.wasm$/);
}
});
});
if (!isServer) {
config.resolve.fallback.fs = false;
}
// Perform customizations to webpack config
config.plugins.push(
new webpack.IgnorePlugin({ resourceRegExp: /\/__tests__\// })
);
config.externals.push({
'node:crypto': 'commonjs crypto',
// 'node:fs': 'commonjs fs',
// 'node:path': 'commonjs path',
// 'node:os': 'commonjs os',
// 'node:util': 'commonjs util',
// 'node:stream': 'commonjs stream',
// 'node:buffer': 'commonjs buffer'
});
// Important: return the modified config
return config;
},
};
export default nextConfig
// export default withBundleAnalyzer(nextConfig)