forked from sportstimes/f1
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnext.config.js
68 lines (63 loc) · 1.76 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
const withFonts = require('next-fonts')
const withPWA = require("next-pwa")
const nextTranslate = require('next-translate')
const {
PHASE_DEVELOPMENT_SERVER,
PHASE_PRODUCTION_BUILD,
} = require('next/constants')
module.exports = (phase) => {
const isDev = phase === PHASE_DEVELOPMENT_SERVER
const isProd = phase === PHASE_PRODUCTION_BUILD && process.env.STAGING !== '1'
const isStaging =
phase === PHASE_PRODUCTION_BUILD && process.env.STAGING === '1'
// Move _public/:site_key to public
require('./build/public-assets');
// Generate the ICS files at build time.
if (isProd || isStaging) {
require('./build/generate-calendars');
}
return withPWA(nextTranslate(withFonts({
pwa: {
disable: !isProd,
dest: "public"
},
redirects: async function redirects() {
if(process.env.NEXT_PUBLIC_MAINTENANCE_MODE === "true"){
return [
{
source: "/generate",
destination: "/maintenance",
permanent: false,
},
{
source: "/timezones",
destination: "/maintenance",
permanent: false,
},
{
source: "/timezone/:slug*",
destination: "/maintenance",
permanent: false,
},
{
source: "/years",
destination: "/maintenance",
permanent: false,
},
{
source: "/year/:slug*",
destination: "/maintenance",
permanent: false,
},
{
source: "/subscribe",
destination: "/maintenance",
permanent: false,
},
]
} else {
return [];
}
}
})))
}