-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathnext.config.ts
More file actions
74 lines (69 loc) · 2.06 KB
/
next.config.ts
File metadata and controls
74 lines (69 loc) · 2.06 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
import type { NextConfig } from 'next';
const nextConfig: NextConfig = {
outputFileTracingRoot: process.cwd(),
webpack: (config, { webpack }) => {
config.resolve = config.resolve || {};
config.resolve.fallback = {
...(config.resolve.fallback || {}),
buffer: 'buffer/',
fs: false,
path: false,
};
config.resolve.mainFields = ['browser', 'module', 'main'];
// Silence known noisy warnings from optional native deps pulled in via stellar-sdk
// (they still work in the browser via fallbacks, but webpack can't statically analyze them).
config.ignoreWarnings = [
...(config.ignoreWarnings || []),
{
module: /node_modules[\\/](require-addon|sodium-native)[\\/]/,
message: /Critical dependency:/,
},
];
// Ignore test files and unnecessary files from node_modules
config.plugins = [
...(config.plugins || []),
new webpack.IgnorePlugin({
resourceRegExp: /^\.\/test\//,
contextRegExp: /thread-stream/,
}),
new webpack.IgnorePlugin({
resourceRegExp: /\.test\.(js|mjs|ts)$/,
}),
new webpack.IgnorePlugin({
resourceRegExp: /\.bench\.(js|mjs|ts)$/,
}),
new webpack.IgnorePlugin({
resourceRegExp: /\/test\//,
}),
new webpack.IgnorePlugin({
resourceRegExp: /\/LICENSE$/,
}),
new webpack.IgnorePlugin({
resourceRegExp: /\/README\.md$/,
}),
new webpack.IgnorePlugin({
resourceRegExp: /^tap$/,
}),
new webpack.IgnorePlugin({
resourceRegExp: /^desm$/,
}),
new webpack.IgnorePlugin({
resourceRegExp: /^fastbench$/,
}),
new webpack.IgnorePlugin({
resourceRegExp: /^pino-elasticsearch$/,
}),
new webpack.IgnorePlugin({
resourceRegExp: /^why-is-node-running$/,
}),
new webpack.IgnorePlugin({
resourceRegExp: /^tape$/,
}),
new webpack.IgnorePlugin({
resourceRegExp: /^pino-pretty$/,
}),
];
return config;
},
};
export default nextConfig;