I found a workaround in this post:
I was running ESP32 Board package version 2.0.2. I reverted to version 2.0.1. Now it works.