How to make Phoenix (etc) optional?

I’m thinking about using Elixir as the basis for a Braille Screen Input facility, to be used on Linux-based mobile phones (e.g., running postmarketOS). For development, I’d like to have copies of Phoenix and associated libraries available. However, I may not want these in the production version.

I’m pretty sure that I can accomplish this by hacking around in mix.exs, but I’m wondering whether there’s anything else I should consider or Best Practices I should follow. Help?


It’s described in Mix documentation:

You can also specify that certain dependencies are available only for certain environments:

{:some_test_dependency, "~> 1.0", only: :test}


That’s pretty much what I had mind, but I was wondering whether there’s anything else I should bear in mind.

There is only one thing I have in mind …

Make sure you would use proper mix environment for compiling/running app and making a release. If :live_dashboard would be :dev-only dependency then you would not be able to use it when testing your app locally in prod environment. Simplest example:

MIX_ENV=prod mix phx.server # without LiveDashboard