Repository navigation
Expand file tree
/
Copy pathnext.config.js
More file actions
102 lines (97 loc) · 2.55 KB
/
Copy pathnext.config.js
File metadata and controls
102 lines (97 loc) · 2.55 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
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
output: "standalone",
images: {
unoptimized: true,
},
webpack: (config, { isServer }) => {
config.ignoreWarnings = [
{
module: /node_modules\/@supabase\/realtime-js/,
message:
/Critical dependency: the request of a dependency is an expression/,
},
];
// Add polyfills for crypto libraries required by @nillion/blindfold
if (!isServer) {
config.resolve.fallback = {
...config.resolve.fallback,
crypto: require.resolve("crypto-browserify"),
stream: require.resolve("stream-browserify"),
buffer: require.resolve("buffer"),
util: require.resolve("util"),
process: require.resolve("process/browser"),
};
// Add ProvidePlugin to ensure Buffer is available globally
const webpack = require("webpack");
config.plugins.push(
new webpack.ProvidePlugin({
Buffer: ["buffer", "Buffer"],
process: "process/browser",
}),
);
}
// Exclude @nillion/blindfold from server-side rendering
if (isServer) {
config.externals = [...(config.externals || []), "@nillion/blindfold"];
}
return config;
},
async headers() {
return [
{
source: "/(.*)",
headers: [
{
key: "X-Content-Type-Options",
value: "nosniff",
},
{
key: "X-Frame-Options",
value: "DENY",
},
{
key: "Referrer-Policy",
value: "strict-origin-when-cross-origin",
},
],
},
{
source: "/sw.js",
headers: [
{
key: "Content-Type",
value: "application/javascript; charset=utf-8",
},
{
key: "Cache-Control",
value: "no-cache, no-store, must-revalidate",
},
{
key: "Content-Security-Policy",
value: "default-src 'self'; script-src 'self'",
},
],
},
{
source: "/register-sw.js",
headers: [
{
key: "Content-Type",
value: "application/javascript; charset=utf-8",
},
{
key: "Cache-Control",
value: "no-cache, no-store, must-revalidate",
},
{
key: "Content-Security-Policy",
value: "default-src 'self'; script-src 'self'",
},
],
},
];
},
};
module.exports = nextConfig;