I am working on a project that is almost, but not quite, an umbrella application. Rather, it contains many mix-projects in subfolders of the apps/
folder, with multiple Mix
projects depending on varying groups of these in subfolders of the rels/
folder.
A minimal example setup can be seen in this GitHub repo
The commands to create it were:
$ mkdir apps/
$ mkdir rels/
$ cd apps/
$ mix phx.new phoenix_app --no-ecto
$ cd ../rels
$ mix new main_app
Now edit rels/main_app/mix.exs
to include the following in the deps()
section:
defp deps do
{:phoenix_app, path: "../../apps/phoenix_app", env: Mix.env()}
end
And edit rels/main_app/config/config.exs
to include the Phoenix-related configuration of the dependency:
import_config "../../../apps/phoenix_app/config/config.exs"
This is the bare minimum to get Phoenix running in development (as well as in production) with this not-quite-umbrella setup, using iex -S mix phx.server
from the main_app
folder.
However, there are two gotchaâs:
- Live code reloading is not working. Making a change to one of the files in
apps/phoenix_app/lib/phoenix_app_web/templates/
for instance does not auto-refresh the page. Even manually refreshing the page will not pick up this change. - Webpack works, but only if someone went to
apps/phoenix_app/assets
and ran thenpm install && node node_modules/webpack/bin/webpack.js --mode development
there. That will work fine for the person who first set up the applications (because Phoenix asks you if you want to âfetch and install dependencies nowâ). But when another contributor fetches the application from Git later, they wonât have the same luck. They need to manually run those commands. They do get a warning when starting up the app to runcd assets && npm install
, but this will not point to the path the Phoenix app itself is installed in, and thus be confusing.
I am trying to resolve these two issues.
What configuration am I missing to make this work without issue?
Feel free to look at and try things out with the minimal example application yourself .
Thanks!~