While he may not have gone completely bankrupt until after the war, he spent the majority of his fortune financing the war, providing the actual weapons of war needed to fight. There was no one paying any taxes at the time so he PERSONALLY funded the war for years. He almost certainly could have been one of our first Presidents had he been interested, although by then he had already lost his status as the richest man in America by far.
https://www.battlefields.org/learn/articles/robert-morris-financier-american-revolution
By 1780, the American economy was near default, and the paper money that had been printed, known as Continentals, were worthless due to inflation. Without Congress able to pay for the needs of the war, foreign diplomats had to convince friendly European governments to loan them hard coin and gold.
In 1781, with the situation remaining in peril, Morris began bankrolling the needed supplies of the Continental army on his own.
The American army began receiving the supplies it needed, and for the next three years, Robert Morris personally financed the American Revolution out of his own pocket. “Morris notes” became widely circulated promissory notes within the ranks of the army.
What I have read suggests that Morris’s associate Haym Salomon deserves much of the credit for financing the revolution. In particular, when George Washington urgently needed $20,000 to march his army to Yorktown in August 1781, it was Salomon who provided the money after Morris couldn’t. And when victory was won, Washington asked Salomon what he wanted as a reward. The reply was “Nothing for me, something for my people”. Reportedly Washington then ordered that that the 13 stars on the Great Seal of the United States be arranged as a Star of David, and so it has been since 1782. Haym Salomon himself was never repaid, and died in poverty 3 years later.