-
Notifications
You must be signed in to change notification settings - Fork 0
/
next.config.js
71 lines (65 loc) · 2.06 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
const headers = [
// set the content security policy here, or comment it out here, but set in your server (NGINX, Apache, etc)
{
key: 'Content-Security-Policy',
value:
"default-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline' 'unsafe-eval'; script-src 'unsafe-inline' 'unsafe-eval' 'self' https://www.googletagmanager.com https://www.google-analytics.com; img-src 'self' data:; connect-src 'self' https://www.googletagmanager.com https://www.google-analytics.com",
},
{ key: 'Referrer-Policy', value: 'origin-when-cross-origin' },
{ key: 'X-Frame-Options', value: 'DENY' },
{ key: 'X-Content-Type-Options', value: 'nosniff' },
{ key: 'X-DNS-Prefetch-Control', value: 'on' },
{ key: 'Strict-Transport-Security', value: 'max-age=31536000; includeSubDomains; preload' },
{ key: 'Permissions-Policy', value: 'geolocation=()' },
]
module.exports = {
images: {
domains: [
'roman-koshkin.unit.oist.jp', // use next js for resizing mechanism on experemental version of the size
// 'i.scdn.co', // Spotify Albums Covers
// 'images.unsplash.com'
],
},
headers() {
if (process.env.NODE_ENV !== 'production') {
return []
}
return [
{ source: '/', headers },
{ source: '/:path*', headers },
]
},
redirects() {
const { posts } = require('./scripts/get-blog-frontmatters')
const externalPosts = posts
.filter((p) => p.original?.external)
.map((p) => ({ source: `/blog/${p.slug}`, destination: p.original.url, permanent: false }))
return [
{
source: '/calendar',
destination: 'https://calendly.com/akellbl4/chat-with-paul',
permanent: false,
},
{
source: '/resume',
destination: '/resume-2022.pdf',
permanent: false,
},
...externalPosts,
]
},
webpack(config, { dev, isServer }) {
if (isServer) {
require('./scripts/generate-sitemap')
require('./scripts/generate-rss')
}
if (!dev && !isServer) {
Object.assign(config.resolve.alias, {
react: 'preact/compat',
'react-dom/test-utils': 'preact/test-utils',
'react-dom': 'preact/compat',
})
}
return config
},
}