Salvation History
The book of Joshua, the first tome in the historical texts section of the Bible, is what scholars call salvation history. Joshua is not meant to be taken literally. In fact, it's discouraged. The salvation history genre is meant to tell a story through the lens of God's help. For instance, we'd ask the question, "If God was aiding the Allies in World War II, how would we write that story?" Some might relay the history of World War II as if nothing has changed, and others might tell a nicer fairy tale of a story, one in which the Allies can do no wrong and God is throwing grenades along with the rest of them.
Salvation history is meant to teach about God's presence in life, but never to be historically accurate. But again, history is but a myth we choose to believe. We know you like it when we get philosophical like that.