-
Notifications
You must be signed in to change notification settings - Fork 83
Expand file tree
/
Copy pathnext.config.js
More file actions
58 lines (52 loc) · 1.89 KB
/
next.config.js
File metadata and controls
58 lines (52 loc) · 1.89 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
/** @type {import('next').NextConfig} */
const nextConfig = {
// Disable strict mode to prevent double rendering of terminal
reactStrictMode: false,
// Optimize barrel imports for better bundle size
// This prevents loading all 1,500+ lucide icons when only ~50-100 are used
experimental: {
optimizePackageImports: ['lucide-react'],
},
// Increase memory limits for Linux systems with less RAM
// This helps prevent OOM crashes during builds
onDemandEntries: {
// Keep pages in memory longer (default: 15000ms)
maxInactiveAge: 60 * 1000,
// Max pages to keep in memory (default: 5)
pagesBufferLength: 3,
},
// CORS headers for Manager/Worker architecture
// Workers need to allow cross-origin requests from managers
// Security handled by Tailscale VPN + firewall (see REMOTE-SESSIONS-ARCHITECTURE.md)
async headers() {
return [
{
// Apply to all API routes
source: '/api/:path*',
headers: [
{ key: 'Access-Control-Allow-Origin', value: '*' },
{ key: 'Access-Control-Allow-Methods', value: 'GET, POST, PUT, DELETE, PATCH, OPTIONS' },
{ key: 'Access-Control-Allow-Headers', value: 'Content-Type, Authorization' },
{ key: 'Access-Control-Allow-Credentials', value: 'true' },
],
},
]
},
webpack: (config, { isServer }) => {
// Handle native modules only on server side
if (isServer) {
config.externals = config.externals || []
config.externals.push({
'node-pty': 'commonjs node-pty',
'cozo-node': 'commonjs cozo-node',
// Don't externalize @huggingface/transformers - it's ESM-only and needs webpack bundling
'onnxruntime-node': 'commonjs onnxruntime-node',
'sharp': 'commonjs sharp',
'pg': 'commonjs pg',
'pg-native': 'commonjs pg-native',
})
}
return config
},
}
module.exports = nextConfig