Except when it is.

This shouldn’t always be said as if the benefits are indisputable. Sharing code across application boundaries isn’t always a good thing, and it can be an especially bad choice as your infrastructure grows, and you have a ton of micro-services and front ends which are tightly coupled due to shared code.

The benefits you gain from breaking everything up into APIs and client side controllers go out the window when you start sharing code between them.