forked from solana-labs/explorer
-
Notifications
You must be signed in to change notification settings - Fork 1
/
next.config.mjs
59 lines (56 loc) · 1.68 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
const ADDRESS_ALIASES = ["account", "accounts", "addresses"];
const TX_ALIASES = ["txs", "txn", "txns", "transaction", "transactions"];
const SUPPLY_ALIASES = ['accounts', 'accounts/top'];
/** @type {import('next').NextConfig} */
const nextConfig = {
experimental: {
// FIXME: https://nextjs.org/docs/messages/missing-suspense-with-csr-bailout
missingSuspenseWithCSRBailout: false,
},
images: {
remotePatterns: [
{
hostname: 'raw.githubusercontent.com',
pathname: '/solana-labs/token-list/main/assets/**',
port: '',
protocol: 'https',
},
],
},
async redirects() {
return [
// Leave this above `ADDRESS_ALIASES`, since it also provides an alias for `/accounts`.
...SUPPLY_ALIASES.map(oldRoot => ({
destination: '/supply',
permanent: true,
source: '/' + oldRoot
})),
...ADDRESS_ALIASES.flatMap(oldRoot => (
[':address', ':address/:tab'].map(path => ({
destination: '/' + ['address', path].join('/'),
permanent: true,
source: '/' + [oldRoot, path].join('/'),
}))
)),
...TX_ALIASES.map(oldRoot => ({
destination: '/' + ['tx', ':signature'].join('/'),
permanent: true,
source: '/' + [oldRoot, ':signature'].join('/'),
}
)),
{
destination: '/address/:address',
permanent: true,
source: '/address/:address/history',
}
]
},
webpack: (config, { isServer }) => {
if (!isServer) {
// Fixes npm packages that depend on `fs` module like `@project-serum/anchor`.
config.resolve.fallback.fs = false;
}
return config;
},
};
export default nextConfig;