South Korean chipmakers recorded their first fall in factory shipments in almost three years in July, highlighting weakening demand for semiconductors that serve as a barometer for the global economy.

Semiconductor shipments tumbled 22.7% from a year earlier, after having risen 5.1% in June, according to a statement from the national statistics office on Wednesday. Nationwide inventories remained elevated in July, up 80% from a year earlier and unchanged from the month prior.

Chip production slowed in July for a fourth straight month, suggesting key producers such as Samsung Electronics Co. and SK Hynix Inc. are adjusting output to reflect cooling demand and mounting stockpiles.

Weakening momentum in Korean chip sales reinforces a darkening outlook for the global economy. A combination of Russia’s war on Ukraine, Covid lockdowns in China and rapid interest-rate increases to tackle inflationary pressures are weighing on activity and crimping the bottom line for businesses.

Semiconductors are key components in a world economy that’s increasingly dependent on electronics and online services. Demand for chips surged during the pandemic as many people switched to remote work and education to minimize the risk of infection.

The decline in semiconductor shipments helps explain a drop in Korea’s technology exports in July, the first fall in more than two years. Memory-chip sales abroad slid 13.5% that month, even though the country’s overall exports advanced 9.4%.

Separately, Korea’s overall industrial production advanced 1.5% in July from a year earlier, less than the 2.6% forecast by economists, the statistics office said.