Widdershin / cycle-restart

Swap out the code in your Cycle.js apps on the fly!
MIT License
123 stars 11 forks source link

Request for universal example #25

Closed geraldyeo closed 8 years ago

geraldyeo commented 8 years ago

First, thanks for creating this.

I'm new to the Cycle ecosystem, and is finding it hard to piece together a working universal app with hot module replacement. It will be good to have an example of this.

SkaterDad commented 8 years ago

One option would be to run 2 servers.

  1. HMR server that updates the client Javascript bundle.
  2. The universal server which renders your cycle app. This server could be launched by Nodemon or something similar, which would restart the server on JS file changes. I don't think true HMR has much value server side since the requests are short and not keeping your cycle app running.

Of course you'll need a build process which runs Babel on your universal server files automatically.

Mixing both of those servers into 1 would be quite interesting, just not sure it's worth it?

geraldyeo commented 8 years ago

I used another starter kit of mine with webpack to experiment, seems to work. https://github.com/geraldyeo/universal-cycle-starter

This Cycle starter kit is still a work in progress.

Widdershin commented 8 years ago

Awesome, once you get everything working, let me know and I'll add a link to the readme.