It's kind of a combination. The targeting for the unit takes place before any shots are resolved - at that point, each individual firing weapon needs to be in range.
However - once that's determined, the weapons that were originally in range, are considered to remain within range for the remainder of that unit's attack.
What do I mean by this? Say you have a unit with mixed weapons... you target with 3 bolters and a plasma gun, all of which are just about in range. You resolve the plasma gun first, as a result your opponent removes models at the front - purely looking at distance, the bolters would now be out of range. But because they were in range when you performed targeting, they can still fire.
Page 217 in the big book:
Note that so long as at least one model in the target unit was visible to the shooting model and in range of its weapon when that unit was selected as the target, that weapon’s attacks are always made against the target unit, even if no models in the target unit remain visible to or in range of it when you come to resolve them (this can happen because of models being destroyed and removed from the battlefield as the result of resolving the shots with other weapons in the shooting model’s unit first).