WITH_EDITOR should be defined as 0 in packaged builds.
Anyway you can made your own macro in *.Buld.cs file, which always will be 0 outside the editor build
PublicDefinitions.Add(String.Format("CUSTOM_WITH_EDITOR={0}", Target.Type == TargetType.Editor ? 1 : 0));