forked from OpenBeta/open-tacos
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnext.config.js
More file actions
110 lines (107 loc) · 2.83 KB
/
next.config.js
File metadata and controls
110 lines (107 loc) · 2.83 KB
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
module.exports = {
output: process.env.DEPLOYMENT_ENV === 'kubernetes' ? 'standalone' : undefined,
images: {
loader: 'custom',
loaderFile: './src/image-loader.js'
},
typescript: {
ignoreBuildErrors: false
},
webpack (config, { isServer }) { // required by @svgr/webpack lib
const fileLoaderRule = config.module.rules.find((rule) => rule.test?.test?.('.svg'))
config.externals = [...config.externals, isServer ? { canvas: 'canvas', jsdom: 'jsdom', paper: 'paper' } : {}]
config.module.rules.push({
test: /\.svg$/i,
issuer: fileLoaderRule.issuer,
// issuer: /\.[jt]sx?$/,
use: ['@svgr/webpack']
})
fileLoaderRule.exclude = /\.svg$/i
return config
},
async headers () {
return [
{
source: '/area/:id*',
headers: [
{
key: 'Cache-Control',
value: 'public, max-age=2592000, stale-while-revalidate=600'
}
]
},
{
source: '/climb/:id*',
headers: [
{
key: 'Cache-Control',
value: 'public, max-age=2592000, stale-while-revalidate=600'
}
]
}
]
},
async rewrites () {
return [
{ // A hack to pass ?gallery=true to getStaticProps()
source: '/u/:uid/:postid',
has: [
{
type: 'query',
key: 'gallery',
value: 'true'
}],
destination: '/u/:uid/:postid/gallery'
}
]
},
async redirects () {
return [
{
source: '/map',
destination: '/maps',
permanent: true
},
{
source: '/areas/:uuid*',
destination: '/area/:uuid*',
permanent: true
},
{
source: '/climbs/:uuid*',
destination: '/climb/:uuid*',
permanent: true
},
{
source: '/crag/:uuid',
destination: '/area/:uuid/',
permanent: true
},
{
source: '/u2/:username',
destination: '/u/:username/ticks',
permanent: true
},
{
source: '/blog',
destination: 'https://openbeta.substack.com/',
permanent: false
},
{
source: '/blog/openbeta-vs-mountain-project-vs-thecrag',
destination: 'https://openbeta.substack.com/p/openbeta-vs-mountainproject-vs-thecrag',
permanent: false
},
{
source: '/partner-with-us',
destination: '/Become-OpenBeta-Partner-Dec-2024.pdf',
permanent: false
}
]
},
experimental: {
optimizePackageImports: ['@phosphor-icons/react']
},
cacheHandler: process.env.DEPLOYMENT_ENV === 'kubernetes' ? require.resolve('./cache-handler.mjs') : undefined,
cacheMaxMemorySize: process.env.DEPLOYMENT_ENV === 'kubernetes' ? 0 : 512 // disable default caching because we have Redis in kubernetes deployment
}