This repository was archived by the owner on Nov 30, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathnext.config.js
87 lines (84 loc) · 1.96 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
const envConfig = require('./env-config')
const serverEnvConfig = require('./server-env-config')
const { i18n } = require("./next-i18next.config")
module.exports = {
i18n,
inlineImageLimit: 1024,
images: {
domains: [],
},
experimental: {
modern: false,
},
publicRuntimeConfig: envConfig,
serverRuntimeConfig: serverEnvConfig,
reactStrictMode: true,
async headers() {
return [
{
source: "/:any*",
headers: [
{
key: "Cache-Control",
value: "public; max-age=45, stale-while-revalidate=600",
},
],
},
{
source: "/",
headers: [
{
key: "Cache-Control",
value: "public; max-age=60, stale-while-revalidate=600",
},
],
},
{
source: "/api/bytes",
headers: [
{
key: "Cache-Control",
value: "private; max-age=0",
},
],
},
{
source: "/api/:any*",
headers: [
{
key: "Cache-Control",
value: "public; max-age=60, stale-while-revalidate=600",
},
],
},
]
},
// options: {buildId, dev, isServer, defaultLoaders, webpack} https://nextjs.org/docs#customizing-webpack-config
webpack: (config) => {
config.resolve.alias = {
...config.resolve.alias,
"react-native$": "react-native-web",
}
config.resolve.fallback = {
...config.resolve.fallback,
http: false, // webpack5 no longer polyfills node packages
https: false, // network-speed requires this but only on node, in browser it does not so no poly
}
config.module.rules.push({
test: /\.md$/,
use: [
{
loader: "raw-loader",
options: {
esModule: false,
},
},
],
})
config.module.rules.push({
loader: "ignore-loader",
test: /\.test.ts$/,
})
return config
},
}