No, the error is the same
iex(1)> 16:39:50 - error: Processing of js/app.js failed. Error: Could not load module ‘./elm.js’ from ‘/home/ubuntu/workspace/my_app/assets/js’. Make sure the file actually exists.
No, the error is the same
iex(1)> 16:39:50 - error: Processing of js/app.js failed. Error: Could not load module ‘./elm.js’ from ‘/home/ubuntu/workspace/my_app/assets/js’. Make sure the file actually exists.
Since I was just struggling with the same annoying problem, thank you, @dustinfarris, for preventing the vein on my forehead from bursting, and @windholtz for asking the question.
I wish Phoenix would use Webpack 2 as its default build tool. Brunch’s documentation is just awful and the path structure is really confusing. Code splitting is also a lot less of a problem with Webpack 2.
Sorry to resurrect an old discussion, but I was using the posts here for reference and had a query:
How come there are two “output directories” for the Elm code:
paths: {
...
public: "../priv/static"
},
and (from @windholtz’s repo):
elmBrunch: {
...
outputFolder: "../assets/js"
}
Also, it seems like there’s a case of “the chicken and the egg” here - js/app.js
seems to be built before the main.js
that is built from main.Elm
. It fails the first time, then succeeds because main.js
now exists, though I suspect will always be one compile behind.
Also, it seems like there’s a case of “the chicken and the egg” here - js/app.js seems to be built before the main.js that is built from main.Elm. It fails the first time, then succeeds because main.js now exists, though I suspect will always be one compile behind.
I also have this problem. It prevents me from adding the generated elm.js
to .gitignore
so I have a big ugly js file in my git repo. Not sure how to tell phoenix to compile elm.js
before running app.js
.
That is mostly just because the elm plugin for brunch is borked. If you drop brunch or make a custom plugin or so then it could be fixed.
That temporal ordering problem between app.js and the Elm compilation step is a real pain, especially for a Phoenix noob like me. Seeing the popup notification on my desktop like 10 seconds later is a further insult
It would certainly seem neater to go with Webpack or even just NPM as the build tool.
@Desty @Most that compilation order bug in elm-brunch
was introduced in this PR: https://github.com/madsflensted/elm-brunch/pull/30.
There is an open issue on it since March but I don’t think the maintainer is active right now. The easiest fix is specify the previous version - 0.7.0 in your package.json.
Glad I’m not the only one. New to Phoenix and Elm I thought I was just being stupid or the instructions I was following when trying to set it up were buggy. Turns out it’s a change in the Phoenix directory structure that 1.3 brought that was causing the instructions not to work.