The present application provides a novel method for generation of a vitamin D2 compound using a continuous flow photoisomerization reactor. A compound represented by formula I: [structure] as further defined herein, is mixed with a solvent and a sensitizer, and is then passed through the continuous flow photoisomerization reactor. If X3 and X4 of formula II is tert-butyldimethylsilyl, then formula II is mixed with a deprotection reagent to obtain the vitamin D2 analog.