Follow-up to the NODE_PATH attempt, which fixed 'accepts' but not the general case: server-custom.js is CJS (esbuild --packages=external) and require()s deps the Next standalone trace ships ESM-only or omits, e.g. drizzle-orm/index.cjs (present-but-incomplete in the traced tree, so a NODE_PATH fallback can't rescue it). Replace the traced node_modules with the complete hoisted prod tree so every external resolves. That tree is prod-only, so move @next/bundle-analyzer (required at runtime by next.config — its import is unconditional even though enabled is gated on ANALYZE) from devDependencies to dependencies; otherwise the standalone config load throws MODULE_NOT_FOUND in prod. Validated end-to-end on a host prod install + standalone assembly: socket server boots, Socket.io initializes, HTTP listens, /api/health → 200, no MODULE_NOT_FOUND, no AsyncLocalStorage invariant. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
6.3 KiB
6.3 KiB