Closed rlopzc closed 6 years ago
I haven’t tried that SPA example, but I recently published a new version of elm-hot-webpack-loader (1.0.1) that should work (it will search for a Browser.Navigation.Key anywhere in your model, even in the variants of a custom type).
Please confirm that you have the latest version of both elm-hot-webpack-loader and elm-hot, and then give it a try and follow-up here. Thanks.
Hi, I made this but didn't work. Am I missing something?
https://github.com/romariolopezc/elm-webpack-4-starter/pull/43
The home page has a counter when you click in the heading. I see that it tries to inject the changes but the browser doesn't change a thing
@romariolopezc I checked out your example. There are 2 things wrong, none of them have to do with Richard's SPA app architecture:
1) you are using Browser.application
, but in your index.js
you are calling Elm init and providing a DOM node to takeover. But that's not necessary since Browser.application
will always take over the body, not the node that you provide.
2) elm-hot
trusts that the node you pass to init
is accurate, but it shouldn't.
For (1), you should remove the "main" div from your index.html
and then in index.js
, invoke Elm as just Elm.Main.init();
(or you can pass it an empty object if you want).
For (2), I created issue #14, and I'll fix it.
I'm glad we found this bug, though :-)
Awesome, thanks for the info!
Can this work with this model?