Glock has long offered a magazine floor plate with a ring for mounting a flashlight...
Original Glock Model 17 10 Round Magazine with Bottom Flashlight Adapter
I suppose, you could dedicate one magazine for bedside duty.
I have no issue sweeping an intruder with my weapon mounted light. If it ain't the wife or the dog, it don't belong here!
Besides, you can flash-light an entire room by skipping the beam off the ceiling.