elm-hot-loader: add hot swapping support to elm-webpack-loader

364 views
Skip to first unread message

Flux Xu

unread,
Feb 10, 2016, 4:40:09 PM2/10/16
to Elm Discuss
I made a webpack loader to use with @rtfeldman 's elm-webpack-loader.
It can hot swap module (instead of reloading page) when you save.




Hope you will find it useful.
Thanks.

Thomas Coopman

unread,
Feb 10, 2016, 4:50:40 PM2/10/16
to Elm Discuss
Nice work!
Looks very useful, going to try this out!

--
You received this message because you are subscribed to the Google Groups "Elm Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elm-discuss...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Robin Heggelund Hansen

unread,
Feb 10, 2016, 6:38:16 PM2/10/16
to Elm Discuss
This is fantastic work Flux Xu! :D

Maxwell Gurewitz

unread,
Feb 10, 2016, 8:17:29 PM2/10/16
to Elm Discuss
Awesome!  Check out elm-server, a package I wrote for this same purpose https://www.npmjs.com/package/elm-server

It also supports asset live reloading without page refreshes, but it's available as a standalone cli tool (without webpack).

Justin Firth

unread,
Feb 12, 2016, 7:27:56 PM2/12/16
to Elm Discuss
This is great, nice work to both you and @rtfeldman!  A lot of great tooling can spring up quickly around this type of solution.  Lack of additional tooling aside, an elm-webpack-loader + elm-hot-loader combo is already a better solution for my generator than the elm reactor in it's current form.  It will greatly simplify the build and watch pipeline, as I am already dependent on webpack for native module packing and style pre- and post-processing.  I hope to bring this in over the weekend.

Simon

unread,
Feb 16, 2016, 1:36:56 AM2/16/16
to Elm Discuss
Does it hotload even in the context of ports / effects? This was the big weakness of the elm-reactor solution?

Flux Xu

unread,
Feb 16, 2016, 9:23:53 AM2/16/16
to Elm Discuss
Yes. It memorizes calls to elm.ports.<portName>.subscibe/unsubscribe and will replay them after hot swap.

Flux Xu

unread,
Feb 16, 2016, 9:24:52 AM2/16/16
to Elm Discuss
Thanks, I hope it will be useful for you! :D

Flux Xu

unread,
Feb 16, 2016, 9:27:54 AM2/16/16
to Elm Discuss
Nice work! But we have to stick with webpack for now because we rely on webpack to handle JSX/LESS/Image files.
Reply all
Reply to author
Forward
0 new messages