-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnext.config.ts
More file actions
53 lines (45 loc) · 1.64 KB
/
next.config.ts
File metadata and controls
53 lines (45 loc) · 1.64 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
import type { NextConfig } from "next";
const nextConfig: NextConfig = {
// Enable Turbopack (default in Next.js 16)
turbopack: {},
// Mark server-only packages as external (prevents bundling for browser)
serverExternalPackages: ['libsodium-wrappers-sumo', 'libsodium-sumo', '@nillion/blindfold'],
webpack: (config, { isServer }) => {
// Handle Nillion dependencies that are not compatible with webpack
if (isServer) {
config.externals = config.externals || [];
config.externals.push({
"libsodium-wrappers-sumo": "commonjs libsodium-wrappers-sumo",
"@nillion/blindfold": "commonjs @nillion/blindfold",
});
}
// Fallback for modules that might not be available in browser
config.resolve.fallback = {
...config.resolve.fallback,
fs: false,
net: false,
tls: false,
crypto: false,
};
// Ignore React Native dependencies in MetaMask SDK and optional wagmi connectors
config.resolve.alias = {
...config.resolve.alias,
'@react-native-async-storage/async-storage': false,
'@gemini-wallet/core': false,
'porto': false,
'porto/internal': false,
'@safe-global/safe-apps-sdk': false,
'@safe-global/safe-apps-provider': false,
// Fix libsodium-wrappers-sumo looking for libsodium-sumo.mjs in wrong location
'libsodium-wrappers-sumo/dist/modules-sumo-esm/libsodium-sumo.mjs': 'libsodium-sumo/dist/modules-sumo-esm/libsodium-sumo.mjs',
};
return config;
},
// Transpile Nillion packages
transpilePackages: [
"@nillion/nilai-ts",
"@nillion/nuc",
"@nillion/secretvaults",
],
};
export default nextConfig;