diff --git a/lib/roles/http/server/lejp-conf.c b/lib/roles/http/server/lejp-conf.c
index 58bb507ad86d8e489f7a1a7ee7458daa1a4eee05..0dfa76b9270c6d616015eaf91a0f9a6d8f21c7e3 100644
--- a/lib/roles/http/server/lejp-conf.c
+++ b/lib/roles/http/server/lejp-conf.c
@@ -873,7 +873,7 @@ static int
 lwsws_get_config_d(void *user, const char *d, const char * const *paths,
 		   int count_paths, lejp_callback cb)
 {
-#ifndef _WIN32
+#if !defined(_WIN32) && !defined(LWS_WITH_ESP32)
 	struct dirent **namelist;
 	char path[256];
 	int n, i, ret = 0;