The retail apocalypse over the past several years has devastated America’s department stores, chains and mom-and-pops. Stores are closing at record levels. The number of people working in retail is on the decline.

And all of that happened at a time when the economy was strong.

Consumers shifting their purchases from traditional stores to online are big part of the problem. In fact, consumer spending remains strong and unemployment is at about a half-century low below 4%.

[Emerketer, a research publication, estimates that the “global retail market will reach $25.038 trillion in 2019, an increase of 4.5% and slight acceleration in growth vs. the prior year. ” Online sales will hit 14 percent of that total, up from 10 percent two years ago.

[That share is forecast to rise to 22 percent by 2023.]

But if the United States slips into a recession, as many economists fear it will sometime next year, the problems plaguing retail could get far worse. Store closings could accelerate and layoffs in the sector — a major provider of American jobs — could spread.

“Brick-and-mortar retailers are already in recession,” said Mark Zandi, chief economist for Moody’s Analytics. “They’ve been laying off workers coming up on three years. And this is a time when consumers are out spending aggressively. If the broader economy is in recession, there is going to be blood in the streets.”

Forever 21 on Sunday was the latest major retailer to file for bankruptcy. It announced plans to close as many as 178 stores in the United States, about a third of those it operates. Earlier this month, Fred’s, a 72-year-old discount chain, said it would close its remaining 300 stores.

US retailers this year have already announced more than 8,200 store closings — well above the previous record of 6,700 in 2017, according to Coresights Research. By year’s end, the annual tally could reach 12,000, Coresights estimates. Payless and Gymboree both filed for bankruptcy for a second time this year, closing nearly 3,000 stores between them.

Raleigh startup Hip eCommerce lands almost $1M from 9 investors

But fears of a downturn loom. Other major economies are already in or near recessions. A trade war between the United States and China could cause the price of consumer goods to rise. A survey by Duke University found that two-thirds of chief financial officers expect a recession by the end of 2020.

Meanwhile, many retailers have borrowed heavily.

“If the economy were to struggle, it would accelerate the collapse of a lot more of the debt-financed retailers. And you would see an acceleration in store closures,” said Greg Portell, lead partner in the global consumer and retail practice of consultant AT Kearney.

So far, many of the retailers that have failed did a poor job meeting consumers’ needs, Portell said. A recession would put a squeeze on even better managed, up and coming, retailers. “Their future depends on them being able to find financing,” he said.

ChannelAdvisor partners with UPS to offer customers variety of services at discounts

Consumers are likely to pull back on spending if unemployment starts to rise, Moody’s Zandi said, and credit is likely to get tighter, both for retailers and for consumers.

“A lot of retailers are hanging on because the broader economic environment is strong, interest rates are low, credit is available,” Zandi said. “No sector is more dependent on credit. If a recession comes, credit will get cut off both to the consumers and the retailers. That is going to mean a rash of bankruptcies and a lot of lost jobs.”

And retail is one of the biggest sources of employment in the US economy, with 15.8 million jobs, or more than 10% of all jobs nationwide. The only areas to employ more people are health care and all the levels of federal, state and local government.

“It employs so many people in every community,” Zandi said. “If consumers pull back and store closings mount, no other sector of the economy will be able to pick up that slack.”

Looking for work? Amazon aiming to hire 30,000 people with more hiring to come

The retail sector has lost nearly 200,000 jobs since the start of 2017, with most of those jobs losses coming from traditional department stores and clothing stores. The job losses across the sector would have been worse had it not been for some new players moving into vacated stores. In a recession, those store openings are likely to slow, and store closings are likely to increase.

So far, the low unemployment rate has meant that many retail workers who lose jobs when stores close are able to find something else. If unemployment increases, as it does in a recession, it will be harder for laid off retail employees to find jobs.

“They are generally lower paying jobs. But they’re very important to a very vulnerable group within the economy,” said Zandi. He said because of that, retailing job losses could worsen any recession, no matter its causes.