-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathnext.config.js
45 lines (40 loc) · 1.13 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
/* eslint-disable @typescript-eslint/no-var-requires */
const { withSuperjson } = require("next-superjson");
const { flow } = require("@mobily/ts-belt");
const withPWA = require("next-pwa");
const withTranspileModules = require("next-transpile-modules");
const shouldAnalyzeBundle = process.env.ANALYZE_BUNDLE === "true";
const getBundleAnalyzerPlugin = () => {
// Required since we install the bundle analyzer as a dev dependency
const withBundleAnalyzer = require("@next/bundle-analyzer");
return withBundleAnalyzer({
enabled: true
});
}
const injectPlugins = flow(
withPWA({
dest: "public",
disable: process.env.NODE_ENV === "development",
disableDevLogs: true
}),
withSuperjson(),
withTranspileModules(["jotai-devtools"]),
...(shouldAnalyzeBundle ? [getBundleAnalyzerPlugin()] : [])
);
module.exports = injectPlugins({
env: {
MONTHS_INACTIVE_OLD_SHEET_DELETE: "3"
// Default value so tests don't throw an error
},
redirects: async () => {
return process.env.NEXT_PUBLIC_MAINTENANCE_MODE === "true"
? [
{
source: "/sheets/:id*",
destination: "/",
permanent: false
}
]
: [];
}
});