-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnext.config.js
More file actions
112 lines (109 loc) · 2.63 KB
/
next.config.js
File metadata and controls
112 lines (109 loc) · 2.63 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
images: {
domains: ['localhost'],
},
experimental: {
optimizeCss: true,
pageLoadTimeout: 60000,
},
webpack: (config, { isServer }) => {
if (!isServer) {
config.resolve.fallback = {
fs: false,
path: false,
os: false,
crypto: false,
stream: false,
http: false,
https: false,
zlib: false,
net: false,
tls: false,
'rpc-websockets': require.resolve('rpc-websockets'),
}
}
config.module.rules.push({
test: /\.m?js/,
resolve: {
fullySpecified: false,
},
})
config.externals.push('encoding', 'pino-pretty', 'lokijs', 'node:crypto')
config.optimization = {
...config.optimization,
splitChunks: {
chunks: 'all',
minSize: 20000,
maxSize: 244000,
minChunks: 1,
maxAsyncRequests: 30,
maxInitialRequests: 30,
cacheGroups: {
default: false,
vendors: false,
framework: {
chunks: 'all',
name: 'framework',
test: /(?<!node_modules.*)[\\/]node_modules[\\/](react|react-dom|scheduler|prop-types|use-subscription)[\\/]/,
priority: 40,
enforce: true,
},
lib: {
test(module) {
return module.size() > 160000 &&
/node_modules[/\\]/.test(module.identifier());
},
name(module) {
const hash = crypto.createHash('sha1');
hash.update(module.identifier());
return hash.digest('hex').substring(0, 8);
},
priority: 30,
minChunks: 1,
reuseExistingChunk: true,
},
},
},
}
return config
},
transpilePackages: [
'@jup-ag/core',
'@solana/web3.js',
'@project-serum/serum',
'@solana/spl-token',
'@metaplex-foundation/mpl-token-metadata',
'@metaplex-foundation/mpl-toolbox',
'@metaplex-foundation/umi'
],
headers: async () => [
{
source: '/:path*',
headers: [
{
key: 'X-DNS-Prefetch-Control',
value: 'on'
},
{
key: 'X-XSS-Protection',
value: '1; mode=block'
},
{
key: 'X-Frame-Options',
value: 'SAMEORIGIN'
},
{
key: 'X-Content-Type-Options',
value: 'nosniff'
},
{
key: 'Referrer-Policy',
value: 'origin-when-cross-origin'
}
]
}
]
}
module.exports = nextConfig