forked from jumperexchange/jumper-exchange
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnext.config.mjs
More file actions
225 lines (212 loc) · 5.85 KB
/
next.config.mjs
File metadata and controls
225 lines (212 loc) · 5.85 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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
import { withSentryConfig } from '@sentry/nextjs';
import withBundleAnalyzer from '@next/bundle-analyzer';
/** @type {import('next').NextConfig} */
const nextConfig = {
output: 'standalone',
trailingSlash: false,
reactCompiler: true,
productionBrowserSourceMaps: false,
serverExternalPackages: ['pino', 'pino-pretty', 'thread-stream'],
experimental: {
serverSourceMaps: false,
optimizePackageImports: ['recharts'],
},
webpack: (config) => {
config.resolve.extensionAlias = {
'.js': ['.ts', '.tsx', '.js', '.jsx'],
};
config.resolve.fallback = { fs: false, net: false, tls: false };
// Walletconnect configuration is blocking the build, pino-pretty needs to be added as an external
config.externals.push('pino-pretty', 'pino', 'thread-stream');
//trying to reduce RAM usage
if (config.cache) {
config.cache = Object.freeze({
type: 'memory',
});
}
return config;
},
images: {
remotePatterns: [
{
protocol: 'http',
hostname: 'localhost',
port: '1337',
pathname: '/**',
},
{
protocol: 'https',
hostname: 'raw.githubusercontent.com',
port: '',
pathname: '/**',
},
{
protocol: 'https',
hostname: 'assets.coingecko.com',
port: '',
pathname: '/**',
},
{
protocol: 'https',
hostname: 's2.coinmarketcap.com',
port: '',
pathname: '/**',
},
{
protocol: 'https',
hostname: 'cdn.sei.io',
port: '',
pathname: '/**',
},
{
protocol: 'https',
hostname: 'static.debank.com',
port: '',
pathname: '/**',
},
{
protocol: 'https',
hostname: 'strapi-staging.jumper.xyz',
port: '',
pathname: '/uploads/**',
},
{
protocol: 'https',
hostname: 'strapi.jumper.exchange',
port: '',
pathname: '/uploads/**',
},
{
protocol: 'https',
hostname: 'strapi.jumper.xyz',
port: '',
pathname: '/uploads/**',
},
{
protocol: 'https',
hostname: 'storage.googleapis.com',
port: '',
pathname: '/jumper-static-assets/upload/**',
},
// {
// protocol: 'https',
// hostname: 'cdn.mygateway.xyz',
// port: '',
// pathname: '/**',
// },
{
protocol: 'https',
hostname: '*.etherscan.io',
port: '',
pathname: '/token/images/**',
},
{
protocol: 'https',
hostname: 'resolve.mercle.xyz',
port: '',
pathname: '/**',
},
{
protocol: 'https',
hostname: 'assets.gravity.xyz',
port: '',
pathname: '/**',
},
{
protocol: 'https',
hostname: 'raw.githubusercontent.com', // TODO: this one can be dangerous
port: '',
pathname: '/lifinance/types/main/src/assets/**',
},
{
protocol: 'https',
hostname: 'assets.coingecko.com',
port: '',
pathname: '/**',
},
{
protocol: 'https',
hostname: 's2.coinmarketcap.com',
port: '',
pathname: '/**',
},
{
protocol: 'https',
hostname: 'static.debank.com',
port: '',
pathname: '/**',
},
{
protocol: 'https',
hostname: 'cdn.sei.io',
port: '',
pathname: '/**',
},
{
protocol: 'https',
hostname: '*.etherscan.io',
port: '',
pathname: '/token/images/**',
},
],
},
async redirects() {
return [
{
source: '/:lng?/swap',
destination: '/',
permanent: true,
},
{
source: '/:lng?/exchange',
destination: '/',
permanent: true,
},
{
source: '/:lng?/refuel',
destination: '/gas',
permanent: true,
},
];
},
};
const withBundleAnalyzerConfig = withBundleAnalyzer({
enabled: process.env.ANALYZE === 'true',
})(nextConfig);
export default withSentryConfig(withBundleAnalyzerConfig, {
// For all available options, see:
// https://docs.sentry.io/platforms/javascript/guides/nextjs/configuration/build/
org: 'jumper-exchange',
project: 'jumper-front',
// For providing readable stack traces for errors using source maps, we need to setup the auth token
authToken: process.env.SENTRY_AUTH_TOKEN,
// Suppresses source map uploading logs during build
silent: false,
// Upload a larger set of source maps for prettier stack traces (increases build time)
widenClientFileUpload: false,
// Transpiles SDK to be compatible with IE11 (increases bundle size)
transpileClientSDK: false,
// Uncomment to route browser requests to Sentry through a Next.js rewrite to circumvent ad-blockers.
// This can increase your server load as well as your hosting bill.
// Note: Check that the configured route will not match with your Next.js middleware, otherwise reporting of client-
// side errors will fail.
// tunnelRoute: "/monitoring",
sourcemaps: {
disable: process.env.VERCEL === '1', // Disable on Vercel to avoid timeouts
assets: ['**/*.js', '**/*.js.map'], // Specify which files to upload
ignore: ['**/node_modules/**'], // Files to exclude
deleteSourcemapsAfterUpload: true, // Security: delete after upload
},
// Automatically tree-shake Sentry logger statements to reduce bundle size
disableLogger: true,
environment: process.env.NEXT_PUBLIC_ENVIRONMENT,
// Enables automatic instrumentation of Vercel Cron Monitors.
// See the following for more information:
// https://docs.sentry.io/product/crons/
// https://vercel.com/docs/cron-jobs
automaticVercelMonitors: true,
bundlePagesRouterDependencies: true,
reactComponentAnnotation: {
enabled: true,
},
});