-
Notifications
You must be signed in to change notification settings - Fork 13
/
next.config.mjs
106 lines (97 loc) · 2.41 KB
/
next.config.mjs
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
/** @type {import('next').NextConfig} */
import path from "path";
import { fileURLToPath } from "url";
import { createRequire } from "node:module";
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const require = createRequire(import.meta.url);
const isOutputStandalone = process.env.NEXT_OUTPUT_STANDALONE === "true";
const securityHeaders = [
{
key: "Strict-Transport-Security",
value: "max-age=63072000; includeSubDomains; preload",
},
{
key: "X-XSS-Protection",
value: "1; mode=block",
},
{
key: "X-Frame-Options",
value: "DENY",
},
{
key: "X-Content-Type-Options",
value: "nosniff",
},
];
const nextConfig = {
sassOptions: {
includePaths: [path.join(__dirname, "styles")],
},
poweredByHeader: false,
compiler: {
// Remove all console.* calls
// removeConsole: false,
},
output: isOutputStandalone ? "standalone" : undefined,
...(process.env.REVIEW_ENV && {
cacheHandler: require.resolve("./nextCacheHandler.mjs"),
cacheMaxMemorySize: 0, // disable default in-memory caching
}),
webpack: (config) => {
// Support reading markdown
config.module.rules.push({
test: /\.md$/,
type: "asset/source",
});
return config;
},
async headers() {
return [
{
// Apply these headers to all routes in your application.
source: "/:path*",
headers: securityHeaders,
},
];
},
async redirects() {
return [
{
source: "/:locale/form-builder/support",
destination: "/:locale/support",
permanent: true,
},
{
source: "/:locale/form-builder/support/contactus",
destination: "/:locale/contact",
permanent: true,
},
{
source: "/:locale/form-builder/:id/responses",
destination: "/:locale/form-builder/:id/responses/new",
permanent: true,
},
{
source: "/:locale/form-builder/edit",
destination: "/:locale/form-builder/0000/edit",
permanent: true,
},
];
},
experimental: {
instrumentationHook: true,
// PPR is only supported in Next.js Canary branches
// ppr: true,
serverComponentsExternalPackages: ["@aws-sdk/lib-dynamodb", "pino"],
serverActions: {
bodySizeLimit: "5mb",
},
turbo: {
rules: {
"*.md": ["raw-loader"],
},
},
},
};
export default nextConfig;