That's a job for the government to do, and there's loads of avenues the government can do if it deems local stores something important for the general population: controlling commercial rents, direct subsidies (colloquially implemented as "tax breaks"), introducing extra taxes on online retail to finance these, or limiting at-scale discounts for Amazon, Walmart and other nationwide chains so that small retail has a chance to compete again.
Well, here in Europe, at least the EU government cares about the experience of the masses. That's how we got no roaming charges for phones, USB-C for everything, decent minimum standards for all possible sorts of products from cucumbers to cars, SEPA, (theoretically) open borders and a whole lot of other things...