forked from Giveth/giveth-dapps-v2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
next.config.js
185 lines (176 loc) · 4.79 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
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
// This file sets a custom webpack configuration to use your Next.js app
// with Sentry.
// https://nextjs.org/docs/api-reference/next.config.js/introduction
// https://docs.sentry.io/platforms/javascript/guides/nextjs/
const { withSentryConfig } = require('@sentry/nextjs');
const withBundleAnalyzer = require('@next/bundle-analyzer')({
enabled: process.env.ANALYZE === 'true',
});
var pjson = require('./package.json');
const generateRobotsTxt = require('./scripts/generate-robots-txt');
const isProduction = process.env.NEXT_PUBLIC_ENV === 'production';
const defaultLocale = 'en';
const locales = ['ca', 'en', 'es'];
const moduleExports = withBundleAnalyzer({
// Your existing module.exports
reactStrictMode: true,
images: {
remotePatterns: [
{ protocol: 'https', port: '', hostname: 'gateway.pinata.cloud' },
{ protocol: 'https', port: '', hostname: 'giveth.mypinata.cloud' },
{ protocol: 'https', port: '', hostname: 'static.tgbwidget.com' },
{ protocol: 'https', port: '', hostname: 'images.unsplash.com' },
{ protocol: 'https', port: '', hostname: 'unicorn.mypinata.cloud' },
{ protocol: 'https', port: '', hostname: 'images.ctfassets.net' },
{
protocol: 'https',
port: '',
hostname: 'lh3.googleusercontent.com',
},
{
protocol: 'https',
port: '',
hostname: 'd2m0e1zy3fwxmp.cloudfront.net',
}, // temporal for CHANGE default image
{ protocol: 'https', port: '', hostname: 'i.imgur.com' },
{
protocol: 'https',
port: '',
hostname: 'd2jyzh4ah9xf6q.cloudfront.net',
}, // temporal for CHANGE default image
{ protocol: 'https', port: '', hostname: 'static.tgb-preprod.com' },
{
protocol: 'https',
port: '',
hostname: 'tgb-preproduction-formio.s3.amazonaws.com',
},
{
protocol: 'https',
port: '',
hostname: 'dashboard.tgb-preprod.com',
},
{
protocol: 'https',
port: '',
hostname: 'cdn-images-1.medium.com',
},
{ protocol: 'https', port: '', hostname: 'ipfs.io' },
{ protocol: 'https', port: '', hostname: '*.amazonaws.com' },
],
},
compiler: {
// ssr and displayName are configured by default
styledComponents: true,
// removeConsole: {
// exclude: ['error'],
// },
},
redirects: () => {
const redirects = [
{
source: '/user',
destination: '/account',
permanent: true,
},
{
source: '/donate',
destination: '/projects',
permanent: false,
},
{
source: '/quests',
destination:
'https://giveth.notion.site/Giveth-s-Galactic-Impact-Quests-f8ef267e16d14acfaba41b43183c17de',
permanent: false,
},
{
source: '/projects',
destination: '/projects/all',
permanent: true,
},
{
source: '/QuadraticForce',
destination: '/assets/Giveth_Report_QF_2024.this.one.pdf',
permanent: false,
},
{
source: '/qfguide',
destination:
'https://giveth.notion.site/Giveth-Quadratic-Funding-3478aa27eb094a699f9ddd6a8b611027',
permanent: false,
},
];
if (isProduction) {
redirects.push(
{
source: '/qf',
destination: '/projects/all',
permanent: false,
},
{
source: '/qf/all',
destination: '/projects/all',
permanent: false,
},
);
} else {
redirects.push({
source: '/qf',
destination: '/qf/all',
permanent: false,
});
}
return redirects;
},
webpack: (config, { isServer, dev }) => {
if (isServer && !dev) {
generateRobotsTxt();
}
return config;
},
i18n: {
locales,
defaultLocale,
localeDetection: false,
},
env: {
locales,
defaultLocale,
},
headers: () => {
return [
{
// Adding CORS headers for /manifest.json
source: '/manifest.json',
headers: [
{
key: 'Access-Control-Allow-Origin',
value: 'https://app.safe.global',
},
{ key: 'Access-Control-Allow-Methods', value: 'GET' },
{
key: 'Access-Control-Allow-Headers',
value: 'X-Requested-With, content-type, Authorization',
},
],
},
];
},
});
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
org: process.env.NEXT_PUBLIC_SENTRY_ORG,
project: process.env.NEXT_PUBLIC_SENTRY_PROJECT,
authToken: process.env.NEXT_PUBLIC_SENTRY_AUTH_TOKEN,
silent: true, // Suppresses all logs
// 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 = withSentryConfig(moduleExports, sentryWebpackPluginOptions);
// module.exports = moduleExports;