Here a single pole switch controls the power to a light fixture. In this case you must change the cable from the switch to the light outlet from a 2 wire to a 3 wire cable.
The black wire should be installed at the top wire screw on the back side of the switch.
Wiring a plug from a light switch.
The black and white would be used for the power for the outlet and the vanity light switch. These will be the only wires connected to the switch. Pull the fixture away from the wall or ceiling and disconnect it from the existing wall ceiling wiring by undoing the wire nuts connecting the wires. Switch box wiring at the switch box the white neutral wires are spliced together and the ground wires are spliced and a pigtail wire is. Install a new black wire to the bottom wire screw on the switch located beneath the top connection just made. The neutral wire from the source is spliced to the white cable wire and continues on to the light.
This wire is needed to complete the circuit. The source is at the switch and 2 wire cable runs from there to the light. Put the light fixture to the side for the time being. Wiring light switches from an outlet with this wiring project the outlet will provide the power source for the light fixtures which are controlled by the light switch so the wire from the outlet leads to the switch location and then to the light fixture. The red wire would be used as the switched leg back up to the vanity light where it would be connected to the black wire of the vanity light. The source hot wire is connected to a switch terminal and the other terminal is connected to the black cable wire.
Connect the black incoming wire to the switch to be installed in the circuit using the screwdriver. Wiring a single pole light switch. How to wire up a electrical outlet to a light switch. Step 3 run a new stretch of wiring from the light fixture to where you ll be locating the outlet. The ground wire sometimes in a green jacket should be connected to your switch and to your lights. At the light the white wire connects to the neutral terminal and the black wire connects to the hot.
As you can see connecting a receptacle to the light would see the receptacle only hot when the light switch is on. Install a 3 wire cable of the same wire gauge from the vanity light to the wall switch. The switch serves to cut the power from reaching the light switch. The white or neutral wire bypasses the switch and goes straight to your lights. Here is what you would have to do if possible change out the 2 wire to 3 wire cable from switch to light.