In a knowledge worker economy the workers own the means of production. In effect, the factory walks out the door when they do. The only way to prevent it is to make sure the knowledge is shared very well among all workers, no one person is a gatekeeper, code is well maintained and high quality, and firing anyone who purposefully tries to "own" the knowledge before they can own it. That's the only way I've found to make sure the factory stays at your company.
It also means that you have to now treat programmers as the "talent" and not the "workers". Think movie star not factory worker and you'll do a lot better. It may seem retarded, but if you want smart creative people to work for you then treat them like smart creative people. Not like a rivet puncher at a factory.
This can't be emphasized enough. It's not enough that you have some technical wizard who is making everything happen at your startup. You have to make sure that the magic becomes a permanent asset, or you are going to get knocked back to the starting line when mr wizard leaves or when it's time to grow the team.
How to do this depends on the particular kind of work being done, but generally speaking you want maintainable code with lots of tests, and records of the valuable knowledge gained in the process.
It's not easy to get this out of most developers, particularly if you are not a developer yourself. If you ignore it, chances are very good it's not being done at all.