forked from stellar-nexus-experience/demo-suite
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnext.config.js
More file actions
127 lines (117 loc) · 4.27 KB
/
next.config.js
File metadata and controls
127 lines (117 loc) · 4.27 KB
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
/** @type {import('next').NextConfig} */
const nextConfig = {
// Optimized for Vercel deployment
poweredByHeader: false,
compress: true,
generateEtags: false,
// Security headers to prevent phishing and malware detection
async headers() {
return [
{
source: '/:path*',
headers: [
{
key: 'Strict-Transport-Security',
value: 'max-age=63072000; includeSubDomains; preload'
},
{
key: 'X-Content-Type-Options',
value: 'nosniff'
},
{
key: 'X-Frame-Options',
value: 'DENY'
},
{
key: 'X-XSS-Protection',
value: '1; mode=block'
},
{
key: 'Referrer-Policy',
value: 'strict-origin-when-cross-origin'
},
{
key: 'Permissions-Policy',
value: 'camera=(), microphone=(), geolocation=()'
},
{
key: 'Content-Security-Policy',
value: [
"default-src 'self'",
"script-src 'self' 'unsafe-eval' 'unsafe-inline' https://apis.google.com https://www.gstatic.com https://www.googletagmanager.com https://vercel.live",
"style-src 'self' 'unsafe-inline' https://fonts.googleapis.com",
"font-src 'self' https://fonts.gstatic.com data:",
"img-src 'self' data: https: blob:",
"connect-src 'self' https://horizon-testnet.stellar.org https://horizon.stellar.org https://www.googleapis.com https://identitytoolkit.googleapis.com https://securetoken.googleapis.com https://firestore.googleapis.com https://firebase.googleapis.com https://firebaseinstallations.googleapis.com https://firebaselogging.googleapis.com https://firebaseremoteconfig.googleapis.com https://www.googletagmanager.com wss://horizon-testnet.stellar.org wss://horizon.stellar.org",
"frame-src 'self' https://*.youtube.com https://www.youtube.com",
"base-uri 'self'",
"form-action 'self'",
"frame-ancestors 'none'",
"upgrade-insecure-requests"
].join('; ')
}
]
}
]
},
// ESLint configuration - ignore during builds to prevent warnings from failing CI
eslint: {
// Ignore ESLint during builds - run linting separately in CI
ignoreDuringBuilds: true,
},
// Webpack configuration to suppress Stellar SDK warnings and optimize build
webpack: (config, { dev, isServer }) => {
// Suppress critical dependency warnings from stellar-sdk and related packages
config.module.exprContextCritical = false;
config.module.unknownContextCritical = false;
config.module.wrappedContextCritical = false;
// Add fallbacks for Node.js modules that aren't available in the browser
config.resolve.fallback = {
...config.resolve.fallback,
fs: false,
net: false,
tls: false,
crypto: false,
stream: false,
url: false,
zlib: false,
http: false,
https: false,
assert: false,
os: false,
path: false,
buffer: false,
process: false,
util: false,
};
// Ignore specific warnings from stellar-sdk dependencies
config.ignoreWarnings = [
// Ignore critical dependency warnings from stellar-sdk
/Critical dependency: require function is used in a way in which dependencies cannot be statically extracted/,
// Ignore warnings from specific modules
/require-addon/,
/sodium-native/,
/@stellar\/stellar-base/,
/stellar-sdk/,
// Additional common warnings to ignore
/Module not found: Can't resolve/,
/export .* was not found in/,
];
// Optimize for client-side builds
if (!isServer) {
// Exclude server-only modules from client bundle
config.externals = config.externals || [];
config.externals.push({
'sodium-native': 'sodium-native',
'require-addon': 'require-addon',
});
}
// Additional optimization for stellar-sdk (removed alias to prevent module resolution issues)
return config;
},
// Experimental features for better performance
experimental: {
optimizePackageImports: ['stellar-sdk', '@stellar/stellar-sdk'],
},
};
module.exports = nextConfig;