Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chain compilation failed #6

Closed
ibnHatab opened this issue Oct 12, 2015 · 3 comments
Closed

Chain compilation failed #6

ibnHatab opened this issue Oct 12, 2015 · 3 comments

Comments

@ibnHatab
Copy link

I think that vendor/*.js compilation started before elm make had finished writing *.js file.

To demonstrate it follow this:

  1. clone https://github.com/urfolomeus/seat_saver.git
  2. npm install
  3. node_modules/brunch/bin/brunch watch --stdin
  4. seat_saver/web/elm$ touch SeatSaver.elm

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

@madsflensted
Copy link
Owner

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.

@ibnHatab
Copy link
Author

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.

@kesipyc
Copy link

kesipyc commented Feb 6, 2016

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...

joakimk added a commit to joakimk/elm-brunch that referenced this issue Feb 9, 2016
joakimk added a commit to joakimk/elm-brunch that referenced this issue Feb 10, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants