-
Notifications
You must be signed in to change notification settings - Fork 56
/
next.config.js
58 lines (53 loc) · 1.66 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
const withPWA = require('next-pwa');
const { createSecureHeaders } = require('next-secure-headers');
const { withSentryConfig } = require('@sentry/nextjs');
const isDevelopmentMode = process.env.NODE_ENV === 'development';
const moduleExports = withPWA({
pwa: {
disable: isDevelopmentMode,
dest: 'public'
},
future: {
webpack5: true
},
poweredByHeader: false,
generateEtags: false,
async headers() {
return [
{
source: '/(.*)',
headers: createSecureHeaders({
forceHTTPSRedirect: [true, { maxAge: 63072000, includeSubDomains: true }],
referrerPolicy: 'strict-origin-when-cross-origin',
nosniff: 'nosniff',
xssProtection: 'block-rendering',
frameGuard: 'sameorigin'
})
}
];
},
webpack: (config, { dev, isServer }) => {
// Replace React with Preact only in client production build
if (!dev && !isServer) {
Object.assign(config.resolve.alias, {
react: 'preact/compat',
'react-dom/test-utils': 'preact/test-utils',
'react-dom': 'preact/compat'
});
}
return config;
},
async redirects() {
return [
{
source: '/videos',
destination: 'https://cutt.ly/covid19comms',
permanent: true
}
];
}
});
const SentryWebpackPluginOptions = {};
module.exports = isDevelopmentMode
? moduleExports
: withSentryConfig(moduleExports, SentryWebpackPluginOptions);