-
Notifications
You must be signed in to change notification settings - Fork 33
/
Copy pathnext.config.js
139 lines (135 loc) · 3.62 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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
// @ts-check
const withNextIntl = require("next-intl/plugin")();
const sassOptions = require("./scripts/sassOptions");
const nrExternals = require("@newrelic/next/load-externals");
/**
* Configure the base path for the app. Useful if you're deploying to a subdirectory (like GitHub Pages).
* If this is defined, you'll need to set the base path anywhere you use relative paths, like in
* `<a>`, `<img>`, or `<Image>` tags. Next.js handles this for you automatically in `<Link>` tags.
* @see https://nextjs.org/docs/api-reference/next.config.js/basepath
* @example "/test" results in "localhost:3000/test" as the index page for the app
*/
const basePath = process.env.NEXT_PUBLIC_BASE_PATH;
const appSassOptions = sassOptions(basePath);
/** @type {import('next').NextConfig} */
const nextConfig = {
async headers() {
return [
{
// static pages are stored for 6 hours, refreshed in the background for
// up to 10 minutes, and up to 12 hours if there is an error
source: "/:path*",
headers: [
{
key: "Cache-Control",
value:
"s-maxage=21600, stale-while-revalidate=600, stale-if-error=43200",
},
{
key: "Vary",
value: "Accept-Language",
},
],
},
// search page is stored 1 hour, stale 1 min, stale if error 5 mins
{
source: "/search",
headers: [
{
key: "Cache-Control",
value:
"s-maxage=3600, stale-while-revalidate=60, stale-if-error=300",
},
],
},
// opportunity pages are stored 10 mins, stale 1 min, stale if error 5 mins
{
source: "/opportunity/:id(\\d{1,})",
headers: [
{
key: "Cache-Control",
value:
"s-maxage=600, stale-while-revalidate=60, stale-if-error=300",
},
],
},
// don't cache the form
{
source: "/subscribe/:path*",
headers: [
{
key: "Cache-Control",
value: "no-store, must-revalidate",
},
],
},
// don't cache the api
{
source: "/api/:path*",
headers: [
{
key: "Cache-Control",
value: "no-store, must-revalidate",
},
],
},
// don't cache user specific pages: saved-grants, saved-search-queries
{
source: "/saved:path*",
headers: [
{
key: "Cache-Control",
value: "no-store, must-revalidate",
},
],
},
// don't cache if users has a session cookie
{
source: "/:path*",
has: [{ type: "cookie", key: "session" }],
headers: [
{
key: "Cache-Control",
value: "no-store, must-revalidate",
},
],
},
];
},
basePath,
reactStrictMode: true,
// Output only the necessary files for a deployment, excluding irrelevant node_modules
// https://nextjs.org/docs/app/api-reference/next-config-js/output
output: "standalone",
sassOptions: appSassOptions,
serverExternalPackages: ["newrelic"],
webpack: (config) => {
nrExternals(config);
return config;
},
eslint: {
dirs: [
"src",
"stories",
".storybook",
"tests",
"scripts",
"frontend",
"lib",
"types",
],
},
experimental: {
testProxy: true,
},
async redirects() {
return [
{
source: "/process",
destination: "/roadmap",
permanent: false,
},
];
},
};
module.exports = withNextIntl(nextConfig);