Import Phoenix Socket, Phoenix HTML JS Modules via Brunch when the web server application is in the umbrella application

When the Phoenix web server is not in the umbrella application, Brunch finds the modules in "deps/phoenix/web/static/js/socket" and "deps/phoenix_html/web/static/js/phoenix_html" because the phoenix dependency is set to this location relative to brunch configuration file.

In the Umbrella application, dependencies are installed in the umbrella application itself, and not in the web server application. So they are on "../../deps/phoenix/web/static/js/" .

I tried adding "../.." to the locations in the brunch configuration file and import statements, and I cannot get Brunch to actually find the files.

+5
source share
1 answer

You need to configure the brunch configuration to point to the appropriate directory:

 watched: ["../../deps/phoenix/web/static", "../../deps/phoenix_html/web/static", "web/static", "test/static"], 

And then import:

 import "../../../deps/phoenix_html/web/static/js/phoenix_html" 

We need to fix Phoenix, though, to create such defaults inside umbrellas.

+7
source

All Articles