Politicians and economists have often debated over the most effective allocation of resources for a country, commonly referred to as the guns-and-butter curve. This curve is defined as a production possibility frontier, where the two variables are domestic and military spending. This shows how spending money in one area comes at the opportunity cost of losing production in the other area. There are both benefits and costs for spending heavily on either guns (the military) or butter (domestic issues).
Whenever a country spends heavily on the military and lacks spending on domestic issues, although they may be strong enough to both invade other countries and deter foreign invasion, the cost is increased dissatisfaction and instability at home. A good example of this is the collapse of the Soviet Union during the Cold War. In order to keep up with Reagan's policy of deficit spending on military buildup, the Soviets invested heavily in the military while experiencing shortages on food, housing, and other basic necessities at home. America could outcompete the Soviets due to their comparative advantage in production of consumer goods and machinery. All of this contributed to the dissolution of the Soviet Union.
If a country chooses to structure their economy around producing domestic goods and focuses less on the military, while they may experience high economic growth and satisfaction in peacetime, the country will be at a disadvantage on the onset of war. However, high investment in production can ensure that one rebounds from the loss of military assets much more quickly. One example of this is the United States during WW2 after the bombing of Pearl Harbor. The Japanese hoped that the preemptive strike would cause the US to be dissuaded from war, while in reality the US brought their superior economic power to bear and started greatly outcompeting the Japanese's spending on the navy. This eventually led to the downfall of the Empire of Japan.
In conclusion, which plan to implement is largely dependent on multiple variables such as peacetime or wartime, location, and the aggressiveness of neighbors. One notable trend is that while peacetime lasts, heavy investment in domestic issues can lead to greater production of military resources during wartime.
https://www.investopedia.com/terms/g/gunsandbutter.asp
https://www.u-s-history.com/pages/h1957.html
https://opentextbc.ca/principlesofeconomics/chapter/33-1-absolute-and-comparative-advantage/
https://www.history.navy.mil/research/library/online-reading-room/title-list-alphabetically/b/budget-of-the-us-navy-1794-to-2004.html