nucleartide / ember-elm

Write Elm in your Ember app
https://medium.com/@nucleartide/introducing-ember-elm-d47f2af73aff
Other
55 stars 7 forks source link

Passing all Elm files into compiler breaks in Elm 0.19.1 #44

Open omarestrella opened 4 years ago

omarestrella commented 4 years ago

With the introduction of 0.19.1, things seem to have gotten a bit more strict in general in the effort to make errors easier to understand to end users. Because of this, passing all Elm files to the compiler will result in an error during compile when your build contains any helper type modules (i.e. modules that dont export main since they dont expose a UI):

-- NO MAIN ---------------------------------------------------------------------

When producing a JS file, I require that given files all have `main` values.
That way functions like Elm.CSS.ChatConversationStyle.init() are definitely
defined in the resulting file. I am missing `main` values in:

... cut for brevity ...

This seems to come about when you use the --output=<filename>.js flag for elm make, which node-elm-compiler does to feed the file back to consumers.

I believe the issue can be remedied by having addon users supply specific files to compile. Or somehow be able to infer which files are used and then sending just those files to the compiler. The Elm compiler will take care of bringing in any module dependencies.

jalandis commented 4 years ago

@omarestrella @MattCheely I created a pull request to address this issue. Please take a look when you get a chance. Your feedback would be appreciated.

https://github.com/nucleartide/ember-elm/pull/45