Gen4's don't have the problem.
If you experience the problem in a Gen3, take note of which magazines you're using. If your magazines have the cut-out in the front for an ambidextrous magazine release, that's the cause. Those newest magazines feed slower than older designs, and on top of that they have excess plastic at the front of each feed lip which can slow feeding even further.
If you have a Gen3 that has the problem, try shaving down the plastic protrusions at the front of each feed lip. You can remove them entirely, the magazines work fine without them. If you still experience feeding problems, try Wolff +10% XP magazines springs in a couple of those magazines.
Alternatively if you have an aftermarket guide rod, you can try a heavier recoil spring. Factory weight for the G22/24/35 is 17lbs and for the G23 it's 18lbs.
The cause is this: The frame is plastic and flexes during firing. With the light attached, the frame flexes less and therefore absorbs less energy. That extra energy goes into the slide, translating into the slide moving rearward faster than it normally would, often just fast enough that speed at which the magazine feeds is not fast enough. Gen4's don't have this problem because the dual guide rod assemblies keep the slide velocity more constant.