One way to prevent this might be the type of wood you will use. Another would be to "finish" your project with this in mind. Look for pre-treatment, stains, top-coats (whether oil-based or water-based) that hold up well to water. If painting look for primer and paint that hold up well to water.
I built a vanity for our bathroom and used primer/paint on it and have not seen any warping. I might want to mention we have 13 people in our house, so the shower/tub gets used often, but we also have another bathroom with shower.