-
Notifications
You must be signed in to change notification settings - Fork 3
/
next.config.js
87 lines (80 loc) · 2.11 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
// @ts-check
const flavours = require('./config/flavour-text');
/** @type {import("next").NextConfig} */
const nextConfig = {
env: {
FLAVOUR_TEXT:
process.env.NEXT_PUBLIC_HOMEPAGE_SPLASH_TEXT ||
flavours[Math.floor(Math.random() * flavours.length)],
},
eslint: {
ignoreDuringBuilds: true,
},
// This config won't be loaded until Netlify supports the `headers` option on `next.config.js`.
// For now, when you make changes here, also make the necessary changes on `netlify.toml`.
// https://github.com/netlify/netlify-plugin-nextjs/issues/150
async headers() {
return [
{
source: '/_next/static/(.*)',
headers: [
{
key: 'Cache-Control',
value: 'public, max-age=31536000, immutable',
},
],
},
{
source: '/(.*)',
headers: [
{
key: 'X-Frame-Options',
value: 'DENY',
},
{
key: 'X-XSS-Protection',
value: '1; mode=block',
},
{
key: 'X-Content-Type-Options',
value: 'nosniff',
},
{
key: 'Referrer-Policy',
value: 'same-origin',
},
],
},
];
},
// https://github.com/vercel/next.js/blob/v12.0.7/packages/next/server/config-shared.ts#L111
productionBrowserSourceMaps: true,
async redirects() {
// https://twitter.com/LiamHammett/status/1260984553570570240
return [
{
source: '/.env',
destination: 'https://www.youtube.com/watch?v=V4MF2s6MLxY',
permanent: false,
},
{
source: '/wp-login.php',
destination: 'https://www.youtube.com/watch?v=V4MF2s6MLxY',
permanent: false,
},
{
source: '/wp-admin',
destination: 'https://www.youtube.com/watch?v=V4MF2s6MLxY',
permanent: false,
},
];
},
webpack: (config, { isServer }) => {
// Fixes npm packages that depend on `fs` module
if (!isServer) {
config.resolve.fallback.fs = false;
}
return config;
},
};
module.exports = nextConfig;