Since you have installed AsyncTCP in the global library storage, it may have been included by the library dependency finder (LDF) when it saw the include for #include <AsyncTCP.h> (ESP Async WebServer has code to include both the ESP32 and ESP8266 libraries), even though it was enclosed in #ifdefs for the ESP32. If you want this behavior to be correct but slower, you need to set lib_ldf_mode = chain+ (docs) which respect the surrounding macros.
1 Like