elmish / hmr

Hot Module Replacement for Elmish apps
https://elmish.github.io/hmr
Other
28 stars 9 forks source link

Make Elmish.Hmr support Webpack, Parcel, Vite #29

Closed MangelMaxime closed 2 years ago

MangelMaxime commented 3 years ago

Different bundler seems to offer different API with a few minor difference.

See #28 and https://github.com/fable-compiler/fable3-samples/issues/10#issuecomment-875304624

alfonsogarciacaro commented 2 years ago

@MangelMaxime I managed to make Elmish.HMR compatible with both Webpack and Vite/Snowpack for Fable.Lit. If it's ok with you, I can send a PR to add similar changes here, although my solution is not Lit-specific so it'd be nice to have a common Elmish.HMR that's not dependent on a specific renderer.

I didn't deal with the Navigation issue though. I think we can use hot.dispose to remove the old subscriptions, but probably patching all potential Program extensions with subscriptions is not scalable. If termination capabilities were added to Elmish as discussed here, Elmish.HMR could terminate the "old" program and each extension should be responsible of cleaning up after themselves.

MangelMaxime commented 2 years ago

@alfonsogarciacaro

I am going to work on this issue (I was waiting to finish Nacara v1 before doing a round of maintenance across my different projects).

I need to refactor the repository structure to make the maintenance easier and also have demo project to tests the different bundler, etc.

MangelMaxime commented 2 years ago

@alfonsogarciacaro Not trying to spam you :)

But as I am not sure if you saw my notification from https://github.com/elmish/hmr/pull/30, I am pinging you here too.

Can you please have a look at my comments from https://github.com/elmish/hmr/pull/30 I have some problem with Vite HMR

alfonsogarciacaro commented 2 years ago

Weird, I did miss the notification indeed 😕 Thanks for letting me know! I'll reply in the PR :+1:

MangelMaxime commented 2 years ago

Done in #30