You can build multiple Main files into a single js file by passing them into elm make
together. For example, you could run elm make src/Init.Main.elm src/Main.elm
. This will produce one file with one instance of the elm runtime and with both of your entry points. When you import the file in javascript, perhaps as Elm
, then you reference them like: Elm.Init.Main.init(...)
and Elm.Main.init(...)
.
3 Likes