Closed ibnHatab closed 8 years ago
Yes - I have seen the same behavior. I haven't had time to debug the details, but suspect that the lies in what kind of events the brunch file watcher listens to, or maybe the elm compiler writes to the file multiple times.
Brunch uses chokidar for watching files, and I see a note in the section on performance about watching larger files, maybe that is something to experiment with.
Once Elm releases with the new DCE (Dead Code Elimination) feature, and the new intermediate file format, I want to look at passing the generated code upstream in the brunch pipeline, see #5, this should also eliminate this issue.
Thank you for clarification.
I tried to fix chokidar with awaitWriteFinish option but it not referenced in brunch/deps/chokidar source anywhere and might be not there yet.
Anyway it is wrong way to fix missing dependence from.elm to .js.
The #5 sounds interesting and for sure will eliminate glitches in brunch.
My workaround was to output elm-make to some tmp file and only after that do a mv to a target file. This way it's more atomic - I never saw "Unexpected end of input" again. Ugly but it works for me...
I think that vendor/.js compilation started before elm make had finished writing .js file.
To demonstrate it follow this:
Observe sporadically failure to compile. << ~/tmp/seat_saver$ node_modules/brunch/bin/brunch watch --stdin master Elm compile: SeatSaver.elm, in web/elm, to ../static/vendor/seatsaver.js 12 Oct 12:56:09 - info: compiled 5 files into 2 files, copied 4 in 15392ms Elm compile: SeatSaver.elm, in web/elm, to ../static/vendor/seatsaver.js 12 Oct 12:56:19 - error: Compiling of 'web/static/vendor/seatsaver.js' failed. Line 75: Unexpected end of input Elm compile: SeatSaver.elm, in web/elm, to ../static/vendor/seatsaver.js 12 Oct 12:56:20 - info: compiled seatsaver.js and 2 cached files into app.js in 271ms Elm compile: SeatSaver.elm, in web/elm, to ../static/vendor/seatsaver.js END
Reproduced on Debian 7, $ uname -a Linux leonis 3.16.0-4-686-pae #1 SMP Debian 3.16.7-ckt11-1 (2015-05-24) i686 GNU/Linux $ node -v
v4.0.0