For awhile now, we’ve been seeing intermittent issues with our build, where a particular module in our application will occasionally be missing from the JavaScript output produced by the Elm compiler. We’ve seen it happening both in our CI environment and when building assets for production. We have yet to see it happen on a development machine. As our codebase has grown, this issue seems to be occurring more and more often, so I thought it might be worth checking if anyone else in the community had experienced anything like it.
As I said, the problem manifests itself by a build producing a JavaScript output file where a particular module is simply missing. We then see an error like this one at runtime:
ReferenceError: Can't find variable: _user$project$Dialog$init
ReferenceError: Can't find variable: _user$project$Dialog$init
When we repeat the build, we get a JavaScript bundle that works just fine. Comparing the contents reveals a chunk of JavaScript corresponding to one of our modules is simply missing. Where the Elm compiler seems to normally generate a single line of whitespace between two modules’ JavaScript output, there is a conspicuous two-line gap at the point where the missing code should be. Here’s what this looks like in a diff tool:

Obviously this is a very long way from anything like a minimal test case that we could submit as a compiler bug, and unfortunately we can’t reproduce it reliably enough to be able to narrow it down.
What I’m hoping is that someone else in the community is seeing something like this too. Actually, if I’m being honest, I’m hoping one of our friends at NoRedInk has experienced this issue and one of them is going to pop in and tell me “Oh yeah, that’s been fixed for the eventual release of 0.19.”
Of possible relevance: we’re building our JavaScript bundles using Webpack and the
elm-webpack-loader. We have it configured to run only a single instance of the Elm compiler at once, though, so I’m not sure how it could be responsible for this issue.
Fingers crossed we’re not alone in this!
--
Kevin Yank
Lead Developer
twitter: @sentience
skype: kevinyank
Culture analytics for your company