I am fairly new to phoenix, and i was trying to make an api with it (was it a mistake¿?) and after a quick research use pow library for the authentication.
Problem: after creating the phoenix api with
== Compilation error in file lib/pow/phoenix/html/core_components.ex ==
** (CompileError) lib/pow/phoenix/html/core_components.ex:5: module Phoenix.Component is not loaded and could not be found. This may be happening because the module you are trying to load directly or indirectly depends on the current module
(elixir 1.14.3) expanding macro: Kernel.use/1
lib/pow/phoenix/html/core_components.ex:5: Pow.Phoenix.HTML.CoreComponents (module)
could not compile dependency :pow, "mix compile" failed. Errors may have been logged above. You can recompile this dependency with "mix deps.compile pow", update it with "mix deps.update pow" or clean it with "mix deps.clean pow"
did i miss any flag in the creation of the api? pow in the release notes it says that is compatible with phoenix 1.7, but maybe is only compatible with a ssr phoenix app?
Do you guys have a recommendation for api authorisation?
Thanks so much in advance, and sorry if this is asked a lot or it is really trivial
I think the problem could be that you passed --no-html flag when creating the Phoenix project, but Pow depends on it (Pow imports Phoenix.Component).
BTW these flags not always mean what you think they are (at least that’s the case for myself). The other day I created a new Phx project without LV functionality (--no-live flag), but it still adds phoenix_live_view to Mix as the project then depends on phoenix_live_view for Heex templates rendering. These flags vary in “integration” levels when not used, for example the mentioned --no-live flag will not inject any LV related config into endpoint/router/etc files but still depends to some degree on the actual LV library (like the heex templates).
You are right, if i make the test creating the api without the flag ---no-html, and then delete the extra files everything works smoothly. Clearly i have to dig more in those phoenix tasks… Thanks for your answer!
I found out the same way you did. But then ran across in the release notes that now phoenix just comes with liveview by default in the deps (so it’s a required dep, but doesn’t produce anything in the project unless you use the dependency).
I actually wasn’t saying that it reads it’s deprecated in the release notes fwiw. I was asserting it is was deprecated (and I was wrong) because I read in the release notes that liveview just comes with phoenix by default now