I am using mix to build an Elixir library.
This library includes an erlang module, in the src directory.
When I require my library into a second project using a relative file path (i.e. I have the full source) it works correctly. I have just published this package to hex and when declaring it as a hex dependency in the same second project I get the error that the erlang module is not loaded.
You're explicitly specifying the list of files to include in the package but the list does not contain src
, which is why the files in src
are not included. You can either add "src"
to that list:
defp package do
[files: ["lib", "mix.exs", "README*", "LICENSE*", "src"],
...
end
or you can remove that key entirely, which will make Hex use the default value of :files
which includes many other files, including src
.