Hello,
because Nucleo-F303k8 is low memory target, then it is supported only under Mbed OS bare metal profile with both version 5 and 6.
Anyway the ESP8266 driver, under MbedOS (5 an 6), uses a Network interface and Sockets APIs and that will probably consume a lot of memory, and also according to this, these APIs are not available with bara metal profile.
- Mbed(5,6) provide a ATCmdParser so you can try to controll ESP with it.
- With Mbed 2, this was also usually done directly via AT commands like this. Or via library ESP8266 - Library for using the Wifi module ESP8266, first … | Mbed
- Search - ESP8266 | Mbed
BR, Jan