The weight in a loss function has no impact on the shuffle option from a DataLoader.
Could it be you are referring to the sampler argument in DataLoader?
The doc 14 states that shuffle cannot be set when a sampler was given.
To sample in a balanced way, you could you a WeightedRandomSampler with its class weights.
However, a weighted loss should work regardless of the sampling method.