-
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathnext.config.mjs
More file actions
61 lines (51 loc) · 1.71 KB
/
next.config.mjs
File metadata and controls
61 lines (51 loc) · 1.71 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
import { fileURLToPath } from 'node:url'
import { dirname, resolve } from 'node:path'
const __filename = fileURLToPath(import.meta.url)
const __dirname = dirname(__filename)
// Detect if running in worktree and use parent directory as root
const isWorktree = __dirname.includes('/worktrees/')
const projectRoot = isWorktree ? resolve(__dirname, '../..') : __dirname
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
typedRoutes: true,
// Compiler optimizations
compiler: {
removeConsole: process.env.NODE_ENV === 'production',
},
// Experimental features for better performance
experimental: {
// Optimize memory usage and tree-shaking for large dependencies
optimizePackageImports: [
'@radix-ui/react-dialog',
'@radix-ui/react-popover',
'@radix-ui/react-select',
'wagmi',
'viem',
'@rainbow-me/rainbowkit',
],
},
// Turbopack configuration
turbopack: {
// Set workspace root to project root (supports worktrees with symlinked node_modules)
root: projectRoot,
},
// Webpack fallback for production builds (still uses webpack)
webpack: (config) => {
// Enable WebAssembly for brotli-wasm (codec compression)
config.experiments = { ...config.experiments, asyncWebAssembly: true }
// Polyfills for Web3 libraries in the browser
config.resolve.fallback = {
...config.resolve.fallback,
fs: false,
net: false,
tls: false,
// Suppress MetaMask SDK React Native import warnings
'@react-native-async-storage/async-storage': false,
// Suppress WalletConnect pino-pretty import warnings
'pino-pretty': false,
}
return config
},
}
export default nextConfig