forked from thirdweb-dev/js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnext.config.mjs
77 lines (74 loc) · 1.67 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
const ContentSecurityPolicy = `
default-src 'self';
img-src * data: blob:;
media-src * data: blob:;
object-src 'none';
style-src 'self' 'unsafe-inline';
font-src 'self';
frame-src * data:;
script-src 'self' 'unsafe-eval' 'unsafe-inline' 'wasm-unsafe-eval' 'inline-speculation-rules' *.thirdweb.com *.thirdweb-dev.com vercel.live js.stripe.com;
connect-src * data: blob:;
worker-src 'self' blob:;
block-all-mixed-content;
`;
const securityHeaders = [
{
key: "X-DNS-Prefetch-Control",
value: "on",
},
{
key: "X-XSS-Protection",
value: "1; mode=block",
},
{
key: "X-Frame-Options",
value: "SAMEORIGIN",
},
{
key: "Referrer-Policy",
value: "origin-when-cross-origin",
},
{
key: "Content-Security-Policy",
value: ContentSecurityPolicy.replace(/\s{2,}/g, " ").trim(),
},
];
/** @type {import('next').NextConfig} */
const nextConfig = {
eslint: {
ignoreDuringBuilds: true,
},
productionBrowserSourceMaps: false,
experimental: {
webpackBuildWorker: true,
webpackMemoryOptimizations: true,
serverSourceMaps: false,
},
async headers() {
return [
{
source: "/(.*)",
headers: securityHeaders,
},
];
},
webpack: (config) => {
config.externals.push("pino-pretty", "lokijs", "encoding");
return config;
},
async redirects() {
return [
{
source: "/connect/sign-in",
destination: "/connect/sign-in/button",
permanent: false,
},
{
source: "/connect/account-abstraction",
destination: "/connect/account-abstraction/connect",
permanent: false,
},
];
},
};
export default nextConfig;