elm-lang / elm-make

A build tool for Elm projects
BSD 3-Clause "New" or "Revised" License
175 stars 45 forks source link

Global Elm can't have to modules under the same namespace #109

Closed bfad closed 8 years ago

bfad commented 8 years ago

This code doesn't take into account the new module may be namespaced:

https://github.com/elm-lang/elm-make/blob/61a36ac09f88e80120b857bf9fa921d8c3d132ea/src/Pipeline/Generate.hs#L222-L229

This means if I have two modules such as Users.List and Users.Show, it will throw an error about there being two Elm modules named "Users" on the page.

process-bot commented 8 years ago

Thanks for the issue! Make sure it satisfies this checklist. My human colleagues will appreciate it!

Here is what to expect next, and if anyone wants to comment, keep these things in mind.

evancz commented 8 years ago

Please provide an http://sscce.org/ and open a new issue explaining the problem through the concrete example.

evancz commented 8 years ago

I see what you are saying now by following the link, but I still think it'd be best to have an issue that says, running the following:

elm-make User/List.elm User/Show.elm

Results in the following error message at runtime:

...

With a title about "when compiling multiple Elm modules into one JS file, ..."

bfad commented 8 years ago

I'll open a properly formatted / detailed issue. Thanks for the pointers as I wasn't sure exactly what my build tool was doing to get this issue.

bfad commented 8 years ago

Doing some more investigating, and it turns out that elm-make is working just fine. My build tool was set to create separate output files for each main module and then concatenate them altogether. The upshot is that there were several copies of Elm and my other modules in my one file. I've fixed my build tool, and everything works great. Thanks again.

evancz commented 8 years ago

Awesome! Glad it's working, and thanks for the update! :)