florish
Problems with HEEx on upgrading a LiveView-less project from Phoenix 1.5 to 1.6
I’m running into some problems while upgrading a Phoenix project from 1.5 to 1.6. Specifically, my question is: why is phoenix_live_view needed as an extra dependency when you only need HEEx and not LiveView?
Context: the application is a small project originally built in Phoenix 1.4 and later upgraded to Phoenix 1.5. It is a “traditional” application with non-LiveView HTML pages rendered using EEx templates.
As suggested in the Phoenix 1.5.x to 1.6 upgrade instructions, I’d like to replace all my EEx (.html.eex files and ~E sigils) with HEEx (.html.heex and ~H sigils).
This step is marked as optional, but if I don’t do this after upgrading phoenix_html to a 3.x version (per the Update your deps instructions), I get warnings like this:
warning: Phoenix.HTML.sigil_E/2 is deprecated. use the ~H sigil instead
Once I replace ~E with ~H, however, I’m starting to get compilation errors:
== Compilation error in file lib/example_web/views/example_view.ex ==
** (CompileError) lib/example_web/views/example_view.ex:24: undefined function sigil_H/2
After some research, I found that sigil_H/2 is defined inside the Phoenix.LiveView.Helpers module. After adding phoenix_live_view to my dependencies and adding import Phoenix.LiveView.Helpers to my views, the compiler errors indeed disappear.
All in all this leaves me with a working Phoenix 1.6 project that does not need LiveView at all, but does need the phoenix_live_view package only for bare HEEx support. This somehow feels weird, as it seems to go against the idea of HEEx to be a (LiveView-independent) replacement for both EEx and LEEx.
And with that I’m getting back to my original question: has LiveView (phoenix_live_view) indeed become a necessary dependency for any Phoenix 1.6+ project that needs HEEx-based HTML rendering? Thanks!
Marked As Solved
cmo
If I remember correctly, it was too hard or too much work to split HEEX out of LiveView and making LV a dependency was the compromise.
Also Liked
sodapopcan
Up to you, but a post from three days ago may give you a bit of insight there. Hard to tell but seems like a weak maybe that it’ll ever happen.
cmo
I think I heard it on this Thinking Elixir podcast ![]()
The info you figured out is in the upgrade guide & it’s comments.
ericlathrop
That’s annoying. I’m going to keep on using ~E until it’s removed, and hopefully by then HEEX will be split out of LiveView.
Popular in Questions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #elixirconf-us
- #advent-of-code
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #hex









