I thought I would take as my starting points what seems to be the internal debate inside the Labour party as to why it ended up where it did in the election. Thesis number one: it was Brexit wot did it. Thesis number two: it was being too left-wing wot did it.
I'm going to suggest that neither analysis, on its own, is adequate. Let's start with Brexit. There is no doubt that Brexit played an important role in explaining the change in party support between 2017 and 2019 (and indeed going back to 2015 as well).
Those who voted leave were much more likely to vote for the Conservatives or the Brexit Party than they were to vote for the Conservatives or UKIP back in 2017. Also, on the remain side, there was a clear relationship between having voted to remain in 2016 and voting for one or other of the parties that were in favour of having a second referendum.