Build-Time Networking Question

How do you allow an image (during build time) to have networking access to the other running containers? They’re in the same docker-compose, and I build doing docker-compose build first-container - then I do docker-compose up first-container. Then when I do docker-compose build dependent-container it cannot build because it cannot talk to the other container using its container name.

Previously, when they could all build independently, it was easy - they could all talk to each other using their container names after built & started.

Any ideas or recommendations?