China was actually quite wealthy under the Qing Dynasty, and fluctuated between 10% and 35% of global GDP.
In 1949, when the PRC was formed, they represented 9.5% of the global economy. In 1990, after 41 years of Communist Party rule, China was 1.59% of the global economy.
You cannot blame that on opium or the west, that is the result of Communist policies like the Cultural Revolution and the Great Leap Forward, to say nothing of the ruthless control and censorship of information.