-
Notifications
You must be signed in to change notification settings - Fork 0
/
next.config.mjs
58 lines (47 loc) · 1.55 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
import { stripIndents } from 'common-tags';
const isProd = process.env.NODE_ENV === "production";
const cdnEndpoint = "itchi.2024.13373333.one";
const cspHeader = stripIndents(`
default-src 'self';
script-src 'self' https://static.cloudflareinsights.com/beacon.min.js https://${cdnEndpoint} ${!isProd ? "'unsafe-eval'" : ""};
style-src 'self' https://fonts.googleapis.com/css2 https://${cdnEndpoint} 'unsafe-inline' ${!isProd ? "'unsafe-eval'" : ""};
img-src 'self' https://${cdnEndpoint} https://cdn.simpleicons.org https://i.ytimg.com/vi/;
font-src 'self' https://fonts.gstatic.com/s/ https://${cdnEndpoint};
media-src 'self' https://${cdnEndpoint};
object-src 'none';
base-uri 'self';
form-action 'self';
frame-src https://www.youtube-nocookie.com/;
frame-ancestors 'none';
block-all-mixed-content;
upgrade-insecure-requests;
`);
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
assetPrefix: isProd ? "https://" + cdnEndpoint : undefined,
poweredByHeader: false,
transpilePackages: ['@tabler/icons-react'],
experimental: {
optimizePackageImports: ["@tabler/icons-react"]
},
images: {
loader: isProd ? "custom" : "default",
domains: isProd ? [cdnEndpoint] : undefined,
unoptimized: true // isProd ? undefined : true
},
async headers() {
return [
{
source: '/(.*)',
headers: [
{
key: 'Content-Security-Policy',
value: cspHeader.replace(/\n/g, ''),
},
],
},
]
},
};
export default nextConfig;