forked from balancer/frontend-v3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
next.config.js
62 lines (58 loc) · 1.38 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
const { withSentryConfig } = require('@sentry/nextjs')
const { sentryOptions } = require('./sentry.config')
/** @type {import('next').NextConfig} */
const nextConfig = {
webpack: config => {
config.resolve.fallback = { fs: false, net: false, tls: false }
config.externals.push('pino-pretty', 'lokijs', 'encoding')
return config
},
logging: {
fetches: {
fullUrl: true,
},
},
images: {
remotePatterns: [
{
protocol: 'https',
hostname: '**',
},
],
},
pageExtensions: ['tsx', `${process.env.PROTOCOL}.tsx`, 'ts'],
// Safe App setup
headers: manifestHeaders,
}
module.exports = withSentryConfig(nextConfig, sentryOptions)
/**
* Add specific CORS headers to the manifest.json file
* This is required to allow the Safe Browser to fetch the manifest file
* More info: https://help.safe.global/en/articles/40859-add-a-custom-safe-app
*/
async function manifestHeaders() {
const corsHeaders = [
{
key: 'Access-Control-Allow-Origin',
value: '*',
},
{
key: 'Access-Control-Allow-Methods',
value: 'GET',
},
{
key: 'Access-Control-Allow-Headers',
value: 'X-Requested-With, content-type, Authorization',
},
]
return [
{
source: '/manifest.json',
headers: corsHeaders,
},
{
source: '/pools/manifest.json',
headers: corsHeaders,
},
]
}