CodeReloader/Recompilation not working during debugging in VSCode

I’m a developer new to Elixir and Phoenix so I’m not really sure if this is an issue or a limitation.

Lately I’ve noticed that during a debugging session using VSCode and elixir-ls, if I edit an ex file (es a channel or a controller) and then I reload the frontend, a js app (svelte) that consume json apis and Phoenix channels, the app crashes with this error in the debugger console:

[error] an exception was raised:
    ** (UndefinedFunctionError) function MrChatWeb.UserChannel.start_link/1 is undefined (module MrChatWeb.UserChannel is not available)
        (mr_chat 0.1.0-fd30e365) MrChatWeb.UserChannel.start_link({MrChatWeb.Endpoint, {#PID<0.2177.0>, #Reference<0.833176470.3639083009.122332>}})
        (elixir 1.14.0) lib/dynamic_supervisor.ex:745: DynamicSupervisor.start_child/3
        (elixir 1.14.0) lib/dynamic_supervisor.ex:731: DynamicSupervisor.handle_start_child/2
        (stdlib gen_server.erl:721: :gen_server.try_handle_call/4
        (stdlib gen_server.erl:750: :gen_server.handle_msg/6
        (stdlib proc_lib.erl:226: :proc_lib.init_p_do_apply/3

After some digging I discovered that the corresponding beam compiled file disappears from _build/dev/lib/mr_chat/ebin, almost like it was deleted before recompilation but never compiled.

Restarting the debugging session fix the behaviour until the next edit.

Everything works fine if I start the project with mix phx.server or iex -S mix phx.server

This behaviour is present in a fresh project too.

just edit lib/test_web/controllers/page_controller.ex during a VSCode debug session and reload the webpage, you will get an error and the controller beam file disappears from _build/dev/lib/test/ebin.

Anyone can help? Restarting the session after every edit is painfully slow.