generated from hackclub/scrapbook
-
Notifications
You must be signed in to change notification settings - Fork 1
/
next.config.js
96 lines (96 loc) · 2.41 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
const withMDX = require('@next/mdx')({ extension: /\.mdx?$/ })
module.exports = withMDX({
experimental: { optimizeFonts: true },
pageExtensions: ['js', 'jsx', 'mdx'],
trailingSlash: false,
images: {
imageSizes: [18, 36, 54, 24, 48, 72, 96, 144],
domains: [
'dl.airtable.com',
'emoji.slack-edge.com',
'cloud-lp0r5yk68.vercel.app',
'avatars.slack-edge.com',
'secure.gravatar.com',
'i.imgur.com',
'i.imgur.com',
'placedog.net',
'www.gravatar.com',
'github.com'
]
},
async rewrites() {
return [
{ source: '/summer', destination: '/r/summer-of-making' },
{
source: '/attachments/:path*{/}?',
destination: 'https://dl.airtable.com/.attachmentThumbnails/:path*'
},
{
source: '/customizer',
destination: 'https://scrapbook-customizer.vercel.app/'
},
{
source: '/customizer/(.*)',
destination: 'https://scrapbook-customizer.vercel.app/$1'
},
{
source: '/avatar/(.*)',
destination: 'https://scrapbook.hackclub.com/api/users/$1/avatar'
},
{
source: '/(.*).png',
destination: 'https://scrapbook.hackclub.com/api/users/$1/avatar'
},
{
source: '/api/emoji',
destination: 'https://badger.hackclub.dev/api/emoji'
},
{
source: '/:username.rss',
destination: '/api/rss/:username'
},
{
source: '/s/:post',
destination: '/judging/:post'
}
]
},
async headers() {
return [
{
source: '/(.*)',
headers: [{ key: 'Access-Control-Allow-Origin', value: '*' }]
},
{
source: '/api/emoji',
headers: [
{
key: 'Cache-Control',
value: 'max-age=1000, stale-while-revalidate'
}
]
},
{
source: '/attachments/(.+)',
headers: [
{ key: 'Access-Control-Allow-Origin', value: '*' },
{ key: 'Access-Control-Allow-Methods', value: 'GET, OPTIONS' },
{ key: 'Access-Control-Allow-Headers', value: 'Content-Type' },
{
key: 'Cache-Control',
value: 'public, max-age=60000, immutable'
}
]
}
]
},
webpack(config, options) {
config.module.rules.push({
test: /\.mp3$/,
use: {
loader: 'file-loader'
}
})
return config
}
})