There is no simplistic answer. Some motors, ie TENV (Totally Enclosed Non Ventilated) are designed to dissipate heat through their case and shaft(s). Although the harmonic content of a PWM output from a VFD is higher than if it were not from a VFD, the heating effect this has is usually not a problem for those motors. If it's a TEFC or ODP design where there is an internal fan, as the motor slows so does the fan and the cooling capacity is lost. But then if the load is centrifugal, such as a pump or fan, then the mitigating factor is that the mechanical LOAD on the motor will decrease at the CUBE of the speed change. So if you are running a motor for a centrifugal pump designed for 60Hz and the VFD turns the speed down to 25% (15Hz), then the LOAD on that motor becomes roughly 6% of what the motor was sized for (affinity law, 25% cubed). So even though you have lost fan cooling, you are at the same time putting almost NO load on that motor.
The remaining problems then come into having a TEFC, ODP or otherwise fan cooled motor used on a constant torque application at very low speeds. For those, you must use the externally powered constant speed cooling fan. Some "inverter duty" motors include it, especially if the motor says is has a 1,000:1 speed range, but it is an option, not a design requirement.