-
Notifications
You must be signed in to change notification settings - Fork 56
/
next.config.js
166 lines (159 loc) · 4.63 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
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
require("@akashnetwork/env-loader");
const withBundleAnalyzer = require("@next/bundle-analyzer")({
enabled: process.env.ANALYZE === "true"
});
const { version } = require("./package.json");
const isDev = process.env.NODE_ENV === "development";
const withPWA = require("next-pwa")({
dest: "public",
disable: isDev
});
const { withSentryConfig } = require("@sentry/nextjs");
try {
const { browserEnvSchema } = require("./env-config.schema");
browserEnvSchema.parse(process.env);
} catch (error) {
if (error.message.includes("Cannot find module")) {
console.warn("No env-config.schema.js found, skipping env validation");
}
}
/**
* @type {import('next').NextConfig}
*/
const moduleExports = {
reactStrictMode: false,
compiler: {
// Enables the styled-components SWC transform
styledComponents: true
},
images: {
domains: ["raw.githubusercontent.com", "avatars.githubusercontent.com"]
},
output: "standalone",
typescript: {
tsconfigPath: "./tsconfig.json"
},
eslint: {
ignoreDuringBuilds: true
},
transpilePackages: ["geist", "@akashnetwork/ui"],
experimental: {
instrumentationHook: true
},
publicRuntimeConfig: {
version
},
i18n: {
locales: ["en-US"],
defaultLocale: "en-US"
},
sentry: {
hideSourceMaps: true
},
webpack: config => {
// Fixes npm packages that depend on `node:crypto` module
config.externals.push({
"node:crypto": "crypto"
});
config.externals.push("pino-pretty");
return config;
},
redirects: async () => {
return [
{
source: "/deploy",
destination: "/cloud-deploy",
permanent: true
},
{
source: "/price-compare",
destination: "https://akash.network/about/pricing/custom/",
permanent: false
},
{
source: "/analytics",
destination: "https://stats.akash.network",
permanent: false
},
{
source: "/graph/active-deployment",
destination: "https://stats.akash.network/graph/active-leases",
permanent: false
},
{
source: "/graph/:path*",
destination: "https://stats.akash.network/graph/:path*",
permanent: false
},
{
source: "/validators",
destination: "https://stats.akash.network/validators",
permanent: false
},
{
source: "/validators/:address*",
destination: "https://stats.akash.network/validators/:address*",
permanent: false
},
{
source: "/addresses/:address*",
destination: "https://stats.akash.network/addresses/:address*",
permanent: false
},
{
source: "/addresses/:address/transactions",
destination: "https://stats.akash.network/addresses/:address/transactions",
permanent: false
},
{
source: "/addresses/:address/deployments",
destination: "https://stats.akash.network/addresses/:address/deployments",
permanent: false
},
{
source: "/deployment/:address/:dseq*",
destination: "https://stats.akash.network/addresses/:address/deployments/:dseq*",
permanent: false
},
{
source: "/blocks",
destination: "https://stats.akash.network/blocks",
permanent: false
},
{
source: "/blocks/:height*",
destination: "https://stats.akash.network/blocks/:height*",
permanent: false
},
{
source: "/transactions",
destination: "https://stats.akash.network/transactions",
permanent: false
},
{
source: "/transactions/:hash*",
destination: "https://stats.akash.network/transactions/:hash*",
permanent: false
}
];
}
};
const sentryWebpackPluginOptions = {
// Additional config options for the Sentry Webpack plugin. Keep in mind that
// the following options are set automatically, and overriding them is not
// recommended:
// release, url, org, project, authToken, configFile, stripPrefix,
// urlPrefix, include, ignore
silent: true, // Suppresses all logs,
dryRun: true,
release: require("./package.json").version,
unstable_sentryWebpackPluginOptions: {
applicationKey: process.env.NEXT_PUBLIC_SENTRY_APPLICATION_KEY
}
// For all available options, see:
// https://github.com/getsentry/sentry-webpack-plugin#options.
};
// Make sure adding Sentry options is the last code to run before exporting, to
// ensure that your source maps include changes from all other Webpack plugins
module.exports = withBundleAnalyzer(withPWA(withSentryConfig(moduleExports, sentryWebpackPluginOptions)));
// module.exports = moduleExports