Only one elm-make process at once?

I have webpack running with the elm loader, I sometimes run builds from the command line and I sometimes run builds from within my editor directly. When these various process are running at once they all run very slowly. I would like something to help avoid this.

Is there any solution to that? Because Elm development is so compiler driven I often get away with stopping webpack until I’m happy with the state of the code but it would be nice to have a smoother journey.

I have spend a bit of time righting a very basic node script that does a kind of client server thing, with a fake ‘elm-make’ script that sits in front of ‘elm-make’ on the PATH, so that elm-make calls just send the command line args to the server that only does one compile at a time. Basic tests seem to work but I haven’t pushed it too far. I’m curious to learn if others have attempted to tackle it? Or will it be addressed in the 0.19 at all? I have seen the issue mentioned in the community before though only once.

Is there any solution to that? Because Elm development is so compiler driven I often get away with stopping webpack until I’m happy with the state of the code but it would be nice to have a smoother journey.

The usual work flow is to have webpack watch your files, then read the compile errors from webpack, rather than building in your editor. Personally, I would just run webpack as needed – but that does have the downside of being slow :slight_smile:

Thanks! Fair point. I find the all red webpack output to be harder to parse & deal with. Maybe there is a way of adjusting that.

I often stop webpack but there are times when it is useful to have it running.

I’m doing the same. Stop webpack, develop using elm-make until I’m happy and then start webpack again. Trying to code something non-trivial is way too slow with Webpack running.

We have this problem at work, and a solution I’d like to try but haven’t had time to implement yet is: write a wrapper script to replace the elm-make binary that would block until all other elm-makes have finished before starting the real elm-make. This could potentially be implemented as an npm package that wraps the existing npm elm pacakge to make installing it easy.

Good to hear! I had a similar thought and have put this together: https://github.com/michaeljones/elm-make-server

There might be better ways to approach it but this seems to work though I haven’t had a chance to test it at length. I’m going to give it a go when I get back to my project at work in the new year.

It isn’t the easiest to set up but hopefully provides a potential proof of concept. I would love to hear some feedback.

1 Like