-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnext.config.js
More file actions
31 lines (28 loc) · 821 Bytes
/
next.config.js
File metadata and controls
31 lines (28 loc) · 821 Bytes
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
/** @type {import('next').NextConfig} */
const nextConfig = {
webpack: (config, { isServer }) => {
if (!isServer) {
// Exclude native node modules from client bundle
config.resolve.fallback = {
...config.resolve.fallback,
fs: false,
net: false,
tls: false,
bufferutil: false,
'utf-8-validate': false,
};
}
// Ignore native dependencies that can't be bundled
config.externals = config.externals || [];
config.externals.push('bufferutil', 'utf-8-validate');
// Add rule to ignore .node files
config.module = config.module || {};
config.module.rules = config.module.rules || [];
config.module.rules.push({
test: /\.node$/,
use: 'node-loader',
});
return config;
},
}
module.exports = nextConfig