-
Notifications
You must be signed in to change notification settings - Fork 0
/
next.config.mjs
60 lines (56 loc) · 1.7 KB
/
next.config.mjs
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
/**
* Webpack config modification adopted from https://github.com/vercel/next.js/issues/11629
*/
const regexEqual = (x, y) => {
return (
x instanceof RegExp &&
y instanceof RegExp &&
x.source === y.source &&
x.global === y.global &&
x.ignoreCase === y.ignoreCase &&
x.multiline === y.multiline
)
}
const nextConfig = {
basePath: process.env.BASE_PATH,
output: 'standalone',
async headers() {
const getHighEntropyValues = 'Sec-CH-UA-Full-Version-List, Sec-CH-UA-Mobile, Sec-CH-UA-Model, Sec-CH-UA-Platform, Sec-CH-UA-Platform-Version, Sec-CH-UA-Arch, Sec-CH-UA-Bitness'
return [
{
source: '/:path*',
headers: [
{
key: 'accept-ch',
value: getHighEntropyValues
},
{
key: 'critical-ch',
value: getHighEntropyValues
}
]
}
]
},
experimental: {
after: true
},
webpack: config => {
const oneOf = config.module.rules.find(
rule => typeof rule.oneOf === 'object'
)
if (oneOf) {
const sassRule = oneOf.oneOf.find(rule => regexEqual(rule.test, /\.module\.(scss|sass)$/))
if (sassRule) {
const sassLoader = sassRule.use.find(
el => el.loader.includes('next/dist/compiled/sass-loader')
)
if (sassLoader) {
sassLoader.loader = 'sass-loader'
}
}
}
return config
}
}
export default nextConfig