One employee at the factory, known as DeMet’s Candy Company, said as many as 70 people work on a shift too many to allow them to stay six feet apart. In an attempt to protect them, the company hung plastic partitions and reduced the airflow inside the factory, the person said.

“They are playing with our life and should not be an essential business,” the worker said, who declined to be identified speaking about her employer. “Chocolate is a luxury.”

Mr. Canals said installing the plastic barriers was one of many precautions taken at its factories in New York and Pennsylvania. Others included “strict social distancing” and “increasing workstation distance,” he said.

New York and New Jersey also have allowed construction to continue, not just on critical infrastructure, but on luxury apartment buildings as well.

That has sparked criticism from workers who fear exposure to the fast-spreading and potentially deadly virus.

“I would get it if we were building hospitals,” a 32-year-old carpenter working on an office renovation in Manhattan said, speaking on the condition of anonymity because he did not have permission from his employer to talk to reporters. “But what office is going to move in after we finish, because they are not allowed to return to work.”

States have taken different stances on gun shops, with some, including Ohio and Michigan, deeming them essential but others, including New York and New Jersey, ordering them closed. In Los Angeles, a disagreement arose between the county’s top lawyer and its sheriff after long lines formed outside gun shops that had remained open.