Scott Alexander in Slate Star Codex:
In my endorsement of anyone except Trump, I told progressives not to vote Trump because they opposed his policy, and conservatives not to vote Trump because he would cause a backlash that was worse than anything they might get from him. I said that the left thrives by imagining themselves as brave rebels fighting an ignorant, regressive, hateful authority, and that “bringing their straw man to life and putting him in the Oval Office” would be “the biggest gift” they could give the Democrats, and would end up pushing an entire generation further to the left.
I think this is a good broad theory of what’s happening, but it might be worth digging deeper to try to distinguish possible mechanisms.
First, maybe Trump is just such an offensive and aversive figure that people switch sides in disgust. This is a little weird; if you were anti-immigration before Trump, can’t you just say “I hate Trump, but I’m still against immigration”? But maybe people’s minds don’t work that way.
Second, maybe Trump made causes like protectionism and nativism so central to the Republican narrative that they became untenable for Democrats. That is, in 2010, it might have been possible to be an anti-illegal-immigration Democrat (remember, in the early 2000s Hillary supported a border fence), but in 2018, that would signal being a Republican, or at least someone of questionable loyalty to the Democratic Party.
More here.