ESP32 C++17 toolchain missing std::optional

Hi, @petoknm how did you manage to fix this? I’m using the following platformio.ini config, and keep receiving:
fatal error: optional: No such file or directory

[env]
build_unflags = -std=gnu++11
build_flags = -std=c++17

[env:esp32doit-devkit-v1]
platform = https://github.com/tasmota/platform-espressif32/releases/download/v2.0.2idf/platform-espressif32-2.0.2.zip
board = esp32doit-devkit-v1
framework = arduino

monitor_speed = 115200

extra_scripts = 
	...

lib_deps = 
	...