“Module not loaded” error for PolymorphicEmbed v4.1.1

Using PolymorphicEmbed v4.1.1

I get the error: module PolymorphicEmbed.HTML.Form is not loaded and could not be found

When attempting to import the module as stated in the docs

Has anyone run into and fixed this problem? Is this an issue with the lib or something else in my project?

Originally posted in the Elixir chat but moved here for search and visibility

This sounds like the same issue, but the comments suggest 4.1.1 should have solved it:

Do you have all the modules that this check is expecting?

1 Like

PhoenixHTMLHelpers.Form is not loaded

Are those modules not loaded automatically by Phoenix? Where would I import them? In my endpoint?

phoenix_html_helpers is listed as an optional dependency for PolymorphicEmbed, so you’ll need to add it to your project’s mix.exs explicitly.

After that, you may need to add it to the lib/whatever_web.ex file in places where use Phoenix.Component happens, for instance:

1 Like

That fixed it thanks