Talk:Creating an Editor Module
Not sure when this came into effect but if you're using UE4.16+
if(Target.Type == TargetType.Editor)
Otherwise UnrealEd will be included in your build and you will get errors when trying to package your project.
Hope this saves someone some heartache.
Credit to Teiwz from this thread.