CustomAction is according to Microsoft the way to do this. Also see their example here:
https://github.com/OfficeDev/PnP/tree/master/Samples/Core.EmbedJavaScript
That it does not work in EditForm.aspx seems a bug to me. You could raise it there.
Alternatively, you could add the JS reference to your masterpage. However, custom masterpages is advised against.
Please remember to mark your question as answered & Vote helpful