We analyse the dynamics of a weakly index-guided semiconductor laser operating near threshold and with optical feedback, using the Lang-Kobayashi model. Lateral effects are included, taking into account lateral carrier diffusion and a lateral profile for the optical field. The laser intensity fluctuates in a sequence of picosecond pulses, and the time-averaged intensity shows sudden dropouts to a nearly zero value, followed by gradual, steplike recoveries. We find that for large carrier diffusion the averaged intensity drops less frequently to zero and recovers less noisily than for low carrier diffusion. We analyse the time evolution of the carriers, and find that at the centre of the active region it fluctuates rapidly following the fast pulsing intensity. Further from the centre of the active region, diffusion has a preponderant effect and the carriers vary more smoothly in time (following the oscillations of the time-averaged intensity). Even further from the centre of the active region, the carrier profile is not influenced by the external optical feedback. The spatial variations of the carrier distribution and of the light intensity distribution within the mode seem to anticipate the occurrence of a dropout.