-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnext.config.js
47 lines (40 loc) · 1.14 KB
/
next.config.js
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
const DEV = process.env.NODE_ENV === "development";
const DEPLOYMENT = require("./src/contract-address-production.json");
// TODO: add network data
const CHAIN_ID_BY_NETWORK = {
mainnet: 1,
bsc: 56,
polygon: 137,
goerli: 5,
};
const basePath = DEV ? undefined : "/router-management-interfaces";
const assetPrefix = DEV ? "" : "/router-management-interfaces/";
// make route map to support URL navigation: https://stackoverflow.com/a/69557638
const exportPathMap = Object.entries(DEPLOYMENT).reduce((acc, [networkName, data]) => {
const chainId = CHAIN_ID_BY_NETWORK[networkName];
const contracts = Object.values(data);
return {
...acc,
...contracts.reduce((acc2, contract) => {
return {
...acc2,
[`/contracts/${chainId}/${contract}`]: {
page: "/contracts/[chainId]/[address]",
},
};
}, {}),
};
}, {});
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
exportPathMap: async function () {
return {
...exportPathMap,
"/": { page: "/" },
};
},
basePath: basePath,
assetPrefix: assetPrefix,
};
module.exports = nextConfig;