I know this is a bit old, but I was struggling with this exact issue on my ESP32-C3-Devkit-M1. I went through a dozen posts over several days before I came across the solution.
For me, the critical addition appeared to be the change in monitor speed. I had been operating at 115200, but it did not work. The specific use of 460800 was noted here and that’s what made it work for me.
I hope this helps the next person!
[env:esp32-c3-devkitm-1]
platform = espressif32
board = esp32-c3-devkitm-1
framework = arduino
upload_port = /dev/cu.usbmodem323101
monitor_speed = 460800
build_flags =
-D ARDUINO_USB_MODE=1
-D ARDUINO_USB_CDC_ON_BOOT=1