How do localized conflicts disrupt supply chains and prompt firms to reorganize them? How do these forces affect firm-level and aggregate economic activity? Using firm-to-firm Ukrainian railway-shipment data before and during the 2014 Russia-Ukraine conflict, we document that firms with prior supplier and buyer exposure to the conflict areas substantially decreased their output. Simultaneously, firms reorganized their production linkages away from partners directly or indirectly exposed to the conflict shock. We build a general-equilibrium production-network model with endogenous link formation, and we show that our model’s sufficient statistics accurately explain the observed relative decline in firm output once we account for network reorganization. Calibrating our model to the Ukrainian economy, we find that the localized conflict decreased aggregate output in nonconflict areas by 5.5%. This effect increases to 8.4% if we abstract from endogenous link formation, suggesting that production-network reorganization partially mitigates the detrimental, far-reaching aggregate economic costs of conflicts.