-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnext_.config.js
More file actions
51 lines (46 loc) · 1.35 KB
/
Copy pathnext_.config.js
File metadata and controls
51 lines (46 loc) · 1.35 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
// next.config.js
const { DefinePlugin } = require("webpack");
const contractAddresses = {
development: "0x9055222122F974B7E6ac8eaAC952A6B6039d26e1",
production: "0x9055222122F974B7E6ac8eaAC952A6B6039d26e1",
test: "0x9055222122F974B7E6ac8eaAC952A6B6039d26e1",
};
module.exports = {
reactStrictMode: true,
compress: true,
webpack: (config, { isServer }) => {
config.plugins.push(
new DefinePlugin({
"process.env.CONTRACT_ADDRESS": JSON.stringify(
contractAddresses[process.env.NODE_ENV]
),
})
);
if (isServer) {
config.plugins.push(
new DefinePlugin({
"process.env.CONTRACT_ADDRESS": JSON.stringify(
process.env.NODE_ENV === "production"
? contractAddresses.production
: contractAddresses.development
),
})
);
}
return config;
},
// rewrites: async () => {
// const env = process.env.NODE_ENV;
// const testUrl = "http://44.214.134.96:8889";
// const prodUrl = "http://44.214.134.96:8889";
// // const prodUrl = "http://balance.game:8888";
// const destination = env === "production" ? prodUrl : testUrl;
// return [
// {
// source: "/api/:path*",
// destination: `${destination}/api/:path*`, // 代理到后端API
// basePath: false
// },
// ];
// },
};