-
Notifications
You must be signed in to change notification settings - Fork 25
/
next.config.js
138 lines (127 loc) · 3.36 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
const withBundleAnalyzer = require('@next/bundle-analyzer')({
enabled: process.env.ANALYZE === 'true',
})
/**
* @0xFable - Suppress errant recoil errors which seem to occur due to hot reloading
* When using the app there is constant recoil warnings in the logs that users could see which indicate
* almost fatal issues with the state.
* Rather than this meaning an issue, on multiple SSR based frameworks there is an issue noted with seeing this on refreshes
* possible because the state/pages are being loaded with hot module replacement
* For more info go here: https://github.com/facebookexperimental/Recoil/issues/733
*/
const intercept = require('intercept-stdout')
// safely ignore recoil stdout warning messages
function interceptStdout(text) {
if (text.includes('Duplicate atom key')) {
return ''
}
return text
}
// Intercept in dev and prod
intercept(interceptStdout)
const config = {
async redirects() {
const redirects = [
{
source: '/',
destination: '/migaloo/swap',
permanent: false,
},
{
source: '/bonding',
destination: '/migaloo/bonding',
permanent: false,
},
{
source: '/pools',
destination: '/migaloo/pools',
permanent: false,
},
{
source: '/vaults',
destination: '/migaloo/vaults',
permanent: false,
},
{
source: '/flashloan',
destination: '/migaloo/flashloan',
permanent: false,
},
]
return redirects
},
// Adding policies:
async headers() {
return [
{
source: '/_next/static/chunks/:slug.js',
headers: [
{
key: 'Content-Type',
value: 'application/javascript',
},
],
},
{
source: '/(.*)',
headers: [
{
key: 'X-XSS-Protection',
value: '1; mode=block',
},
{
key: 'X-Frame-Options',
value: 'DENY',
},
{
key: 'Content-Security-Policy',
value: "frame-ancestors 'none'",
},
{
key: 'X-Content-Type-Options',
value: 'nosniff',
},
],
},
];
},
reactStrictMode: false,
// TODO: Needed to disabled all build error checking and eslint checking due to error with usage of Controller component, to fix that needs to be fixed
typescript: {
// !! WARN !!
// Dangerously allow production builds to successfully complete even if
// your project has type errors.
// !! WARN !!
ignoreBuildErrors: true,
},
output: "standalone",
eslint: {
// Warning: This allows production builds to successfully complete even if
// your project has ESLint errors.
ignoreDuringBuilds: true,
},
images: {
loader: 'cloudinary',
path: 'https://res.cloudinary.com/dk8s7xjsl/image/upload/',
},
webpack(config, { webpack }) {
config.plugins.push(
new webpack.ProvidePlugin({
Buffer: ['buffer', 'Buffer'],
})
)
if (!config.resolve.fallback) {
config.resolve.fallback = {}
}
Object.assign(config.resolve.fallback, {
buffer: false,
crypto: false,
events: false,
path: false,
stream: false,
string_decoder: false,
})
return config
},
}
module.exports = withBundleAnalyzer(config)