This would be unconstitutional as hades under the legal and spirit of the law. There is no such thing as a codified “national popular vote” for the Presidency. There is not a uniformed standard of voting laws/regulations to oversee a national vote. Each State has their own set of requirements, thus depriving a voter from another State concerning a “national vote” if this were to happen.
The Federal government would have to amend the Constitution for this to happen in order to set a uniform voting standard (Division of Power is already codified). Yes, some rogue judge or Appellate Court could go AWOL on the law in theory, however, this will not sit well with the current makeup of the USSC.
The Federal government would have to amend the Constitution for this to happen in order to set a uniform voting standard (Division of Power is already codified). But how does one get an accurate count of the popular vote? Some states don't count every ballot (absentee). When the margin is greater than the unopened ballots, victory is declared and the results are certified.