Second or third largest economy in the world is extremely difficult given that there is the United States, Japan, the Ottoman Empire, Germany, United Kingdom, Italy, China, India, Russia, Brazil, etc. as potential competitors. You can knock some of them out, as happened with OTL competitors like Russia or Brazil which hasn't quite caught up, but not all of them. Fundamentally France is a country of 70 million people and competing with massive countries with hundreds of millions or billions like China, India, the USA, or even Japan, is hard.
You would need something equivalent to a nuclear exchange where the only country not impacted is France, or an extremely convoluted and low probability history.
This is especially hard since IMO of the European great powers France came out perhaps the best in the 20th century - the British lost their empire, Ireland, have been reduced to an American satellite state, their leading economic status in Europe gone. The Germans of course lost their empire too - not that that means very much for them - and much more importantly huge swathes of territory in Europe, so that even if Germany is still the richest and second most populous European nation, compared to what it could have been in absolute terms it is a pale shadow. I've argued in the past that the world wars were in relative terms a benefit for Germany compared to most other European powers, and that's still true I think, but Germany was still very much impacted by the wars and its 20th century has been a troubled one as well. Russia is even worse with the greatest retrenchment and largest loss of territories that it has ever experienced. Austria-Hungary collapsed. Italy is the only one which might be compared to France since it mostly maintained its position at the start and continues to be what it was then - a middle-weight regional power. The wars might have been hard on France but the French have generally been able to, in diplomatic terms at least, cushion their impact.
So what do you need to improve France's stance? You need a lot more people - and here just having less devastating world wars won't help you, since the French population growth figures were very low, and so some calculations without the world wars but also without the French post-war baby boom actually see the French have less population. You need to massively wipe out competitors. And you almost certainly need the empire to compete since otherwise the USA, China, Japan, etc. are almost impossible to deal with.
Before the First World War a different army administration rather than Joffre comes to charge, and is able to launch major reforms and significant improvements to the French military, based upon massive increases in artillery, significant doctrinal changes, dramatic increases in efficiency, major strength increases with a colonial army from Africa hugely increased in size and to be deployed to Europe, new and advanced military-weapons like artillery, light machine guns, and the semi-automatic rifle, etc. These are relayed to the Germans and they decide that attacking France is no longer feasible, while the Italians, encouraged by increasing French land strength, come more to the French side. When WW1 breaks out the Germans only go East, with the Russians suffering crippling damage before managing to hold the Germans on a defensive line, while the Italians and French are arrayed on the Russian side but neither is capable of launching major offensives. The Ottomans are neutral which greatly aids the Russians, and the British enter the war on the Russian side in a panic when it seems that the Russian empire is on the verge of collapse. This is a double-edged sword, because the immediate British institution of a strangle-hold blockade on Germany is so incredibly extreme that it leads to a declaration of war by the United States on the British. With time ticking a massive entente attack, with massive amounts of French artillery, tanks, and firepower striking the German armies in Alsace, coordinated offensives by the Entente navies in an all-out strike to crush the German and Austro-Hungarian fleets regardless of losses, Italian general offensives and major amphibious landings, and Russian equivalents to the Brussilov offensive is planned. The French offensive is stunningly successful with the surprise appearance of tanks and the huge artillery barrages as well as sophisticated new tactical doctrines from observers on the Russian front, and the French smash through Alsace-Lorraine, while the Russians are quickly reinforced by the Romanians and make massive inroads into Austria-Hungary and the Italians finish the blow from the West. The Allied navies take massive casualties but the German fleet is destroyed, and a major British amphibious landing occurs in the Baltic with Russian assistance. Aggressive Allied attacks keep the Central Powers off balance and they collapse. The damage is sown however: the Russian empire implodes almost as soon as the peace treaty is signed, falling into feuding factions of communists, socialists, monarchists, republicans, and ethnic nationalists along the frontiers. Germany is crippled and huge territories are ripped from it in the East and West, alongside major reparations, its colonial empire distributed up, and secession movements in Southern Germany unite with Austrians to form two competing German states - while Austria-Hungary itself collapses.
This still leaves the Americans however, in their war against the British, with the Japanese having joined the English against the Americans. The British decision to fight until the last shell against the Germans enabled them to win quickly, but at tremendous cost in naval units: the resultant war between the English and the Americans grows more and more bitter as fighting in Canada escalates and sees reprisals and violence by both sides. Japan, in addition to taking the German colonies in the closing days of the war, seizes the Philippines and American Pacific possessions, while climatic battles between the British and American fleets in the Caribbean see both sides ground down to a nub, but ultimately a British victory taking the American Caribbean colonies. Canada however, after a painful battle, ultimately falls, with casualties on both sides reaching tragic numbers. The grinding battle by both sides results in bankruptcy for the Japanese, and ultimately a peace of exhaustion between the powers happens - with everyone involved having lost, to tremendous financial, economic, and demographic harm to all involved. for a return to status quo ante bellum. A cold war between the Americans and British sets in.
The French benefit from this period with major industrial sales to the British, economic loans, snapping up Liberia without American protection, and small British enclaves in West Africa being sold to the French to help finance the war. Internally the French economy, with the territories taken from Germany, large reparations, and favorable international trade, booms during the war, and a post-war baby boom sets in. With a rich and fast developing economy and gratitude to the colonial population who had made major military contributions to the French victory over Germany, significant liberalization, economic development, educational extension, and reform occurs in the colonies, similar to the Sarraut plan of the 1920s but on an even greater scale. Combined with increasing European economic integration, this sets the tone for a decades long expansion of the French economy and a constantly fast growing population.
Decades later, another major war breaks out between the British and the Japanese, and the Americans, this time with the Chinese and then the newly reconstituted Russia joining against the Japanese and British. The American offensive is a catastrophe against the massive British defenses in Eastern Canada, and a huge conflagration in East Asia sees huge fighting between the involved sides. The Ottomans jump into the war against Russia, and once again a years-long stalemate happens - with the Russians once again collapsing, joined by the Ottomans with quick interventions by the French and Italians to secure post-war spheres of influence. Although the Americans this time are victorious, taking Canada, the Caribbean, and the Japanese collapsing under the combined weight of the Chinese army and American submarine raiding offensives, the cost of the war is far too much for the Amerians, and years of stagnation and ultimately civil war set in. The British Empire is in even worse shape, with a major independence war breaking out in India seeing bloody fighting which sees casualties rise into the millions, the independence of a united Ireland, and anarchy in Africa - one exploited by the French, who under the guise of restoring order take over much of Britain's African colonies, imitated by the Italians who do the same in East Africa. Belgium also breaks apart, leading to the French annexation of Wallonia and then Luxembourg.
This world order exists to the present, with the United States in chaos and riven by fighting factions, Russia balkanized and thrown into anarchy, the Ottoman empire collapsed, the British Empire destroyed and England impoverished by the years of war and thoroughly behind France, India thrown in bloody sectional violence, Japan struggling under massive bankruptcy and in a perpetual cold war with the Chinese, while the Chinese themselves never see a massive economic take-off. Germany's split into two nations gels. The French are the last ones standing, peacefully shedding their more distant colonies like Indochina and most of tropical Africa over time even as they maintain significant influence there, while closer and less difficult colonies are better integrated, and the internal population boom continues to this day. Although the Americans are somewhat larger economically, the gap is not that large, and all other great economic powers have essentially collapsed or been neutered. The world is a much less economically developed place as a whole, even though former French colonies have done better out of it, and much more centered on Europe than in our timeline, where France and its partner Italy are at the center of the European project.