Years later, simply set
export ELECTRON_OZONE_PLATFORM_HINT=wayland
This does the same as specifying --ozone-platform=wayland
, when starting the program.
See https://www.electronjs.org/docs/latest/api/environment-variables#electron_ozone_platform_hint-linux.