Phoenix LiveView + Hot reload crashes the app
Closed this issue · 1 comments
The hot reload crashes the app when I have debug on and I update a LiveView module.
It shows the following error when changing a dummy value on the module:
== Compilation error in file lib/loreware_web/live/game_live.ex ==
** (UndefinedFunctionError) function Phoenix.LiveView.__using__/1 is undefined or private. However, there is a macro with the same name and arity. Be sure to require Phoenix.LiveView if you intend to invoke this macro
(phoenix_live_view 0.19.5) Phoenix.LiveView.__using__([])
lib/loreware_web/live/game_live.ex:2: (module)
(elixir 1.15.6) lib/kernel/parallel_compiler.ex:377: anonymous fn/5 in Kernel.ParallelCompiler.spawn_workers/8
How to reproduce it:
1 - git clone git@github.com:macabeus/loreware.git
(it's mainly the phoenix initial app)
2 - cd loreware
3 - git checkout bug
4 - mix deps.get
5 - mix ecto.create
6 - on VS Code, run the action mix phx.server
7 - go to the page http://localhost:4000/game
8 - update the value on game_live.ex
9 - it crashes the app!
If you run mix phx.server
from the terminal, it works as expected.
You can change game_live.ex
and it refreshes correctly on the browser - bug the VS Code debuggers won't work, obviously... 😢
(I'm beginning in Elixir, so I can be doing a dummy mistake; I'm not sure if it's an issue here or on elixir-lsp/elixir-ls
)
Environment
- Elixir & Erlang versions (elixir --version): Erlang/OTP 26 [erts-14.0.2] [source] [64-bit] [smp:10:10] [ds:10:10:10] [async-threads:1] [jit] [dtrace]
Elixir 1.15.6 (compiled with Erlang/OTP 26)
- VSCode ElixirLS version: 0.16.0
- Operating System Version: darwin 23.0.0
That's a known issue. Phoenix live reload breaks debug session phoenixframework/phoenix_live_reload#133