The reasons against all-melee or all-range groups are are given by a lot of people her.
But to answer your question about that topic:
If you want to play an all-melee group, then you must prepare for the ranged attacks of enemys. Block the line of sight with trees (feather token tree) or mist or a solid barrier (ask the spellcasters) and so on. Even potions of invisibility will do and they are cheap.
If you want to play an all-range group, then you must hold the melee enemys from your throat. Block there way to you with barriers, pools of fire, ice and acid (ask an alchemist), knock them back with rings of ram or even stop them with summoned monsters.