It has always been up to the states how they apportioned their electoral votes, and it has gone through many different versions to arrive where we are now, including electors being independent of the actual popular vote, and allowing faithless electors. It was only in the late 19th century that states began apportioning all of their electors as a block to the winner, rather than by district. The constitution leaves it to the states.