Specify main modules for elm make
See original GitHub issueIf my understanding is correct it’s currently necessary to specify all main modules that will be using ports to elm-make. For example:
elm-make Components/ComponentA/Main.elm Components/ComponentB/Main.elm
If left unspecified, it will result in an build error that says there cannot be multiple main modules. Something like this:
This module has ports, but ports can only appear in the main module.
89│ port tasks : Signal (Task Never ())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Ports in library code would create hidden dependencies where importing a module
could bring in constraints not captured in the public API. Furthermore, if the
module is imported twice, do we send values out the port twice?
I’m not sure what the appropriate solution is. Considering you specify the path to a single Main module via require.
require('Components/ComponentA/Main.elm')
require('Components/ComponentB/Main.elm')
It would seem that if you did this you’d output the entire Elm core run-time with each component.
Issue Analytics
- State:
- Created 8 years ago
- Reactions:2
- Comments:18 (13 by maintainers)
Top Results From Across the Web
Modules · An Introduction to Elm
Elm has modules to help you grow your codebase in a nice way. On the most basic level, modules let you break your...
Read more >Easier Code Organization
To summarize, Elm makes it very easy to group functions, constants, type definitions, and other values together using modules. The syntax for creating...
Read more >Using modules in Elm
In Elm, files and modules have a one-to-one correspondence. If you want to break out a piece of code into a separate file,...
Read more >Modules - Learn You an Elm
An Elm module is a collection of related functions and types. An Elm program is a collection of modules where the main module...
Read more >Hello World · Elm Tutorial - sporto
This will create an elm-package.json file and elm-stuff directory in the same project directory, and then install the specified modules.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Implemented and released as part of 4.4.0. elm-webpack-loader will be maintained after 0.19.
See here for how to use it: https://github.com/elm-community/elm-webpack-loader#files-default---path-to-required-file
I believe both projects will likely be obsolete after the upcoming 0.19 release. I’m glad the project works for you!