Skip to content

Gleam compile error if dependency has dev dependencies that are not fetched by mix #47

Description

@spicychickensauce

While I could resolve #46 via workarounds, this one is actually holding me back from moving forward.

I get this error when trying to compile a project with a (git) gleam dependency:

3> error: Unknown module
3>     ┌─ ./test/my_app_test.gleam:128:5
3>     │
3> 128 │     envoy.get("MAX_NODES") |> result.try(int.parse) |> result.unwrap(30_000)
3>     │     ^^^^^
3>
3> No module has been found with the name `envoy`.
3> could not compile dependency :my_app, "mix compile" failed.

my_app has a dev dependency on envoy:

[dev-dependencies]
envoy = ">= 1.1.0 and < 2.0.0"

It is translated into this mix.exs:

{:envoy, ">= 1.1.0 and < 2.0.0",
   [only: [:dev, :test], runtime: false]},

But I think mix doesn't fetch test / dev dependencies of dependencies, so then gleam fails to compile.
But why does it even try to compile the test/ folder? shouldn't it only compile the src/ folder?

(I hope elixir-lang/elixir#14262 will solve that too, but until that one is merged, I'll try my luck here)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions