Finally got around to checking this! Turns out pg was already in serverExternalPackages when the build dropped it. That prevents it from being bundled, but Next.js still couldn't follow TypeORM's dynamic require() when tracing files, so pg never made it into the standalone output. Passing driver: pg directly is what actually fixed it. Thanks for the suggestion!