Modafinil and Chronic Fatigue

Modafinil is used off-label to treat chronic fatigue. But the question is: What's the relation between modafinil and chronic fatigue? **How does modafinil function to treat this condition**?