elm/compiler

Bug?: Confusing behaviour when combining `--optimize` with `--output=/dev/null`

dave4420 opened this issue · 1 comments

Setup:

src/Main.elm:

module Main exposing (main)

main : Program () () ()
main = Debug.todo "eventually"

I run elm make src/Main.elm --optimize --output=/dev/null.

Expected behaviour

The compiler gives me an error (including exiting with a non-zero status code), just as it would if I had specified --output=some.js.

Actual behaviour

The compiler prints Success! to stdout and exits with status 0.

Versions

  • Elm: 0.19.1
  • Operating System: macOS Sonoma 14.4.1

Additional Details

This appears to be caused by the compiler not generating code when given --output=/dev/null, and therefore not checking whether the Debug module is used.

An alternative would be to output a message in this case saying that --optimize --output=/dev/null does not check that --optimize --output=some-file.js would succeed, only that the source code typechecks.

Thanks for reporting this! To set expectations:

  • Issues are reviewed in batches, so it can take some time to get a response.
  • Ask questions in a community forum. You will get an answer quicker that way!
  • If you experience something similar, open a new issue. We like duplicates.

Finally, please be patient with the core team. They are trying their best with limited resources.