This repository was archived by the owner on Oct 21, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathnext.config.mjs
94 lines (90 loc) · 3.05 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
import bundleAnalyzer from "@next/bundle-analyzer";
/**
* Run `build` or `dev` with `SKIP_ENVIRONMENT_VALIDATION` to skip environment
* validation. This is especially useful for Docker builds.
*/
process.env.SKIP_ENVIRONMENT_VALIDATION !== "true" &&
(await import("./src/environment.mjs"));
const withBundleAnalyzer = bundleAnalyzer({
enabled: process.env.ANALYZE_BUNDLE === "true",
openAnalyzer: false,
});
/** @type {import("next").NextConfig} */
const nextConfig = {
experimental: {
legacyBrowsers: false,
},
headers: async () => [
{
/** @see https://nextjs.org/docs/advanced-features/security-headers */
headers: [
/** @see https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP */
{
key: "Content-Security-Policy",
value: `
child-src 'none';
connect-src 'self' blob: ws: *.gstatic.com;
default-src 'self';
frame-ancestors 'none';
img-src 'self' data: https://i.imgur.com/0UzB7N1.jpg https://i.imgur.com/7nVHtOd.png https://i.imgur.com/jOjPBNg.jpg https://i.imgur.com/l5kIze3.png https://i.imgur.com/Zadamhe.jpg;
media-src 'none';
script-src 'self' 'unsafe-eval' 'unsafe-inline' blob:;
style-src 'self' 'unsafe-inline';
worker-src 'self' blob:;
`
.replace(/\s{2,}/g, " ")
.trim(),
},
/** @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Feature-Policy */
{
key: "Permissions-Policy",
value: "camera=(), geolocation=(), microphone=()",
},
/** @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referrer-Policy */
{
key: "Referrer-Policy",
value: "strict-origin-when-cross-origin",
},
/** @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Strict-Transport-Security */
{
key: "Strict-Transport-Security",
value: "includeSubDomains; max-age=31536000; preload",
},
/** @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Content-Type-Options */
{
key: "X-Content-Type-Options",
value: "nosniff",
},
/** @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-DNS-Prefetch-Control */
{
key: "X-DNS-Prefetch-Control",
value: "on",
},
/** @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Frame-Options */
{
key: "X-Frame-Options",
value: "DENY",
},
],
source: "/(.*)",
},
],
images: {
remotePatterns: [
{
hostname: "i.imgur.com",
pathname: "/l5kIze3.png",
protocol: "https",
},
],
},
poweredByHeader: false,
reactStrictMode: true,
/**
* TODO: remove `swcMinify` option when the issue is resolved.
*
* @see {@link https://github.com/pmndrs/drei/issues/1102 `<Text/>` fails to load font when Next.js app is deployed to Vercel}
*/
swcMinify: false,
};
export default withBundleAnalyzer(nextConfig);