question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Specify main modules for elm make

See original GitHub issue

If 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:closed
  • Created 8 years ago
  • Reactions:2
  • Comments:18 (13 by maintainers)

github_iconTop GitHub Comments

1reaction
eeue56commented, Oct 29, 2017

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

1reaction
dynajoecommented, Oct 29, 2017

I believe both projects will likely be obsolete after the upcoming 0.19 release. I’m glad the project works for you!

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found