$ npm install elm-hot
This package provides the core infrastructure needed for doing hot code swapping in Elm. It supports Elm 0.19 only.
This low-level package is intended for authors of Elm application servers.
If you're looking for something that's easier to use, and you're willing to use Webpack, see elm-hot-webpack-loader, which is built using this package. Another option is Parcel which has built-in support for Elm and this package.
The goal of this package is to provide a reusable core that can be used to provide hot code swapping support in a variety of environments--not just Webpack.
Browser.Navigation.Key
changed locationModel
contains Json.Encode.null
elm-hot
core API$ npm install --save elm-hot
function inject(str)
Injects the hot code swapping functionality into a compiled Elm app.
eval
-ed in the browser.const elmHot = require('elm-hot');
const {compileToStringSync} = require('node-elm-compiler');
const injectedCode = elmHot.inject(compileToStringSync(["src/Main.elm"], {}));
In order to provide something similar to webpack-dev-server
with hot module reloading, an application server could be developed to do the following:
index.html
to receive push events from the server.elm
files on disk for changeselm-hot
to inject the hot-code-swapping logic)Elm
object and calls eval()
on the new code from the serverI have implemented something similar to this for the integration tests. See test/server.js and test/client.js for inspiration.
The above description is probably a bit too vague, so if you would like more details, create an issue.
Elm hot code swapping is based on the work of Flux Xu's elm-hot-loader.
© 2010 - cnpmjs.org x YWFE | Home | YWFE