The Constitution gives States exclusive powers on how electoral votes are handled. Remember in 2000 the Florida Legislature was prepared to allocate their electoral votes to George Bush if necessary.
Yes, I remember that happening in Florida. The Constitution gives each state the authority to choose electors. The electors don’t have to be chosen by “popular” vote; that aspect of our elections evolved over time so that now all states choose electors by popular vote.