The compiler tells me to split module names depending on the directory structure. But it also complains if two files in different directories have the same name. Example:
I have a Main.elm file which has the main and update functions. I have some initialisation stuff in a file Init/Init.elm with a module Init. But the compiler complains about this.
When I change the Init.elm file to Main.elm, and the module to Init.Main, the compiler complains that I have two modules called Main, even though one is named Init.Main .
This means I will have to come with unique names for the last part of every module, making things convoluted.
Try to reproduce this error in a SSCCE. I have tried creating a folder structure with a Main.elm and a folder named Init containing another file Main.elm that contains the module Init.Main and it works just fine.
Later Edit: Upon some more experiments I realized that the error might be due to multiple source directories.
If you have a src folder with a Main.elm and a init folder with a Main.elm and both these folders listed in the source-directories, you will get into a conflict.
They are compiled to 2 separate JS files. I’m fairly certain you can have multiple entry points in the same file, in my case though they are separate because they are being loaded by separate HTML files.
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(...).