-
Notifications
You must be signed in to change notification settings - Fork 3
/
next.config.mjs
129 lines (119 loc) · 3.23 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
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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
const basePath = process.env.BASE_PATH || ''
const rpcUrls_1 =
(process.env.EL_RPC_URLS_1 && process.env.EL_RPC_URLS_1.split(','))
const rpcUrls_5 =
process.env.EL_RPC_URLS_5 && process.env.EL_RPC_URLS_5.split(',')
const rpcUrls_17000 =
process.env.EL_RPC_URLS_17000 && process.env.EL_RPC_URLS_17000.split(',')
const etherscanApiKey = process.env.ETHERSCAN_API_KEY
// Mainnet is the default chain
const _defaultChain = '1';
// Keep both Mainnet and Holesky as defaults
const defaultSupportedChains = '1,17000'
const defaultChain = process.env.DEFAULT_CHAIN || _defaultChain
const supportedChains = process.env.SUPPORTED_CHAINS || defaultSupportedChains
const cspTrustedHosts = process.env.CSP_TRUSTED_HOSTS
const cspReportOnly = process.env.CSP_REPORT_ONLY
const cspReportUri = process.env.CSP_REPORT_URI
const ipfsMode = process.env.IPFS_MODE
const walletconnectProjectId = process.env.WALLETCONNECT_PROJECT_ID
export default {
basePath,
// webpack5: true,
experimental: {
// Fixes a build error with importing Pure ESM modules, e.g. reef-knot
// Some docs are here:
// <https://github.com/vercel/next.js/pull/27069>
// You can see how it is actually used in v12.3.4 here:
// <https://github.com/vercel/next.js/blob/v12.3.4/packages/next/build/webpack-config.ts#L417>
// Presumably, it is true by default in next v13 and won't be needed
esmExternals: true,
},
compiler: {
styledComponents: true,
},
webpack(config) {
config.module.rules.push({
test: /\.svg.react$/i,
issuer: { and: [/\.(js|ts|md)x?$/] },
use: [
{
loader: '@svgr/webpack',
options: {
prettier: false,
svgo: true,
svgoConfig: {
plugins: [
{
name: 'removeViewBox',
active: false,
},
],
},
titleProp: true,
},
},
],
})
config.module.rules.push({
test: /\.(t|j)sx?$/,
use: [
{
loader: 'webpack-preprocessor-loader',
options: {
params: {
IPFS_MODE: String(ipfsMode === 'true'),
},
},
},
],
})
return config
},
// WARNING: Vulnerability fix, don't remove until default Next.js image loader is patched
images: {
loader: 'custom',
},
async headers() {
return [
{
// Apply these headers to all routes in your application.
source: '/(.*)',
headers: [
{
key: 'X-DNS-Prefetch-Control',
value: 'on',
},
{
key: 'Strict-Transport-Security',
value: 'max-age=63072000; includeSubDomains; preload',
},
{
key: 'X-Content-Type-Options',
value: 'nosniff',
},
{
key: 'Referrer-Policy',
value: 'same-origin',
},
],
},
]
},
serverRuntimeConfig: {
basePath,
rpcUrls_1,
rpcUrls_5,
rpcUrls_17000,
etherscanApiKey,
cspTrustedHosts,
cspReportOnly,
cspReportUri,
},
publicRuntimeConfig: {
defaultChain,
supportedChains,
ipfsMode,
walletconnectProjectId,
},
}