-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnext.config.js
More file actions
100 lines (89 loc) · 2.31 KB
/
Copy pathnext.config.js
File metadata and controls
100 lines (89 loc) · 2.31 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
/** @type {import('next').NextConfig} */
const nextConfig = {
// Silence Turbopack error when webpack config is present
turbopack: {
root: __dirname,
},
webpack: (config, { isServer, webpack }) => {
// Solana/Anchor browser fixes
config.resolve.fallback = {
...config.resolve.fallback,
fs: false,
path: false,
crypto: false,
stream: false,
os: false,
net: false,
tls: false,
child_process: false,
readline: false,
zlib: false,
http: false,
https: false,
url: false,
assert: false,
buffer: require.resolve("buffer/"),
};
config.plugins.push(
new webpack.ProvidePlugin({
Buffer: ["buffer", "Buffer"],
})
);
config.experiments = {
...config.experiments,
asyncWebAssembly: true,
layers: true,
};
if (isServer) {
config.externals = [
...(config.externals || []),
"@solana/web3.js",
"@coral-xyz/anchor",
];
}
// Silence ox/viem critical dependency warnings
config.module.rules.push({
test: /node_modules\/ox\/.*\.js$/,
loader: 'string-replace-loader',
options: {
search: 'critical dependency',
replace: '',
flags: 'i'
}
});
// Alternative way to silence specific warnings if the above doesn't work well
config.ignoreWarnings = [
{ module: /node_modules\/ox/ },
{ module: /node_modules\/viem/ },
{ message: /Critical dependency: the request of a dependency is an expression/ }
];
return config;
},
async headers() {
return [
{
source: "/(.*)",
headers: [
{
key: "Cross-Origin-Opener-Policy",
value: "same-origin-allow-popups",
},
{
key: "Cross-Origin-Embedder-Policy",
value: "unsafe-none",
},
],
},
];
},
transpilePackages: [
"@solana/wallet-adapter-base",
"@solana/wallet-adapter-react",
"@solana/wallet-adapter-react-ui",
"@solana/wallet-adapter-wallets",
"@solana/spl-token",
"@lifi/widget",
"@lifi/sdk",
],
};
module.exports = nextConfig;