I was thinking about creating a wizard character. Reviewing the spellcasting rules, I saw this:
Most spells that require attack rolls involve ranged attacks. Remember that you have disadvantage on a ranged attack roll if you are within 5 feet of a hostile creature that can see you and that isn't incapacitated (see chapter 9).
There are a lot of occasions that might arise that would make this a problem, or at least a bit of a hindrance. So as a D&D player normally would when they wanted to break a rule without actually cheating, I went to a list of feats and found Crossbow Expert:
Thanks to extensive practice with the crossbow, you gain the following benefits:
You ignore the loading quality of crossbows with which you are proficient.
Being within 5 feet of a hostile creature doesn't impose disadvantage on your ranged attack rolls.
When you use the Attack action and attack with a one handed weapon, you can use a bonus action to attack with a hand crossbow you are holding.
I may be (am) overthinking things, but does this apply to magic attacks, such as cantrips like Eldritch Blast or Fire Bolt? The literal meaning of the feat says that I can, but it could also imply by the title and also the effects of the feat that this only applies to crossbows, or any other ranged weapon, excluding magic. The strongest evidence that it might not affect ability with ranged magic attacks is:
Thanks to extensive practice with the crossbow
With a crossbow, not with magic.
Best Answer
Yes, you can use the Crossbow Expert feat in this manner.
It's a fairly common build for spellcasters.
As you have realized, the point in question in the feat affects "ranged attacks". It says nothing about ranged weapon attacks. A ranged spell attack is indeed a ranged attack.
Here is a designer tweet to that effect
and better yet, here is the official word from the SA Compendium: