The 10th and 12th Amendments say so. How the electors are chosen is up to the states.
My point is that there is definitely still some wiggle room in whether states can require electors to vote in a particular way. I'm sure that state laws requiring electors to vote for the national popular vote winner will be challenged in court AND ignored by at least some Republican electors whatever the courts rule.