Flashing order is what keeps water out
Every layer around a window has to shed onto the layer below it. Shingles on a roof work the same way. The sill pan goes in first. Anything that gets past the unit lands in a tray and drains back out. The window is set and fastened. The jamb flashing laps over the sill pan. The head flashing laps over the jamb flashing. The house wrap laps over the head flashing. Done in that order, water always has a path down and out.
Reverse any lap and the same detail funnels water into the wall instead of out of it. There it rots framing. It shows up as a drywall stain long after anyone would connect it to the window. This is the step that separates a window that lasts from one that becomes a repair. It is invisible the moment the trim goes on.


