# A way to disable Elm Optimize Level 2 in Elm Pages build

**URL:** <https://discourse.elm-lang.org/t/a-way-to-disable-elm-optimize-level-2-in-elm-pages-build/8281>\
**Category:** Request Feedback\
**Created:** [March 29, 2022, 3:19pm UTC](https://discourse.elm-lang.org/t/a-way-to-disable-elm-optimize-level-2-in-elm-pages-build/8281 "2022-03-29T15:19:55Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![lazurski](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/lazurski/32/2785_2.png) [@lazurski](https://discourse.elm-lang.org/u/lazurski)\
**Post date:** [March 29, 2022, 3:19pm UTC](https://discourse.elm-lang.org/t/a-way-to-disable-elm-optimize-level-2-in-elm-pages-build/8281/1 "2022-03-29T15:19:55Z")

</div>

We run into a bit of a dead end that we described here: [https://github.com/mdgriffith/elm-optimize-level-2/issues/93](https://github.com/mdgriffith/elm-optimize-level-2/issues/93). We would love to help resolve it at the root, but it looks like it might take some time. In the meantime we need a workaround to continue working on our project. It seems like using the standard Elm compiler might be the easiest route.

I quickly glanced at the source code of Elm Pages generator and it seems that elm-optimize-level-2 is a hard dependency. Am I right? If so, would it make sense for it it to be optional? Would you @dillonkearns be open for a PR in this direction? Is there anything I should consider first?

Probably I’ll try to fork it later today and see how far I can go with it. We need to get un-stuck quickly.

cc: @mdgriffith

ps: I’m really grateful for both projects and all the work you and others put into them. Thanks!

---

<div class="post-metadata">

**Author:** ![dillonkearns](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/dillonkearns/32/1587_2.png) [@dillonkearns](https://discourse.elm-lang.org/u/dillonkearns)\
**Post date:** [March 29, 2022, 4:10pm UTC](https://discourse.elm-lang.org/t/a-way-to-disable-elm-optimize-level-2-in-elm-pages-build/8281/2 "2022-03-29T16:10:50Z")

</div>

Yeah, I think it would make sense to have an option to disable elm-optimize-level-2. Or another way to put it, to run `elm-pages build` in different modes:

1. Debug (`--debug`)
2. Without `--optimize` and without EOL2 (elm-optimize-level-2)
3. With `--optimize` but without EOL2
4. With `--optimize` and EOL2

I would love to discuss more, I think a good starting point for the discussion would be to propose what the `elm-pages build` command would look like for each of those 4 modes.

For example:

| Number | Description | Command |
| --- | --- | --- |
| 1 | Debug (`--debug`) | `elm-pages build --debug` |
| 2 | Without `--optimize` and without EOL2 (elm-optimize-level-2) | `elm-pages build ???` |
| 3 | With `--optimize` but without EOL2 | `elm-pages build ???` |
| 4 | With `--optimize` and EOL2 | `elm-pages build ???` |

I think a GitHub issue on the `elm-pages` repo would be a better place to discuss those details. Would you mind opening an issue there to continue the conversation?

---

<div class="post-metadata">

**Author:** ![lazurski](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/lazurski/32/2785_2.png) [@lazurski](https://discourse.elm-lang.org/u/lazurski)\
**Post date:** [March 29, 2022, 5:47pm UTC](https://discourse.elm-lang.org/t/a-way-to-disable-elm-optimize-level-2-in-elm-pages-build/8281/3 "2022-03-29T17:47:12Z")

</div>

> [@dillonkearns](#):
>
> I think a GitHub issue on the `elm-pages` repo would be a better place to discuss those details. Would you mind opening an issue there to continue the conversation?

Good idea. Here: [A way to disable Elm Optimize Level 2 · Issue #288 · dillonkearns/elm-pages · GitHub](https://github.com/dillonkearns/elm-pages/issues/288)

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex035/uploads/elm_lang/original/1X/50a05e53677a2c3b47776d7abd0f113eb50193a1.png) [@system](https://discourse.elm-lang.org/u/system)\
**Post date:** [April 8, 2022, 5:47pm UTC](https://discourse.elm-lang.org/t/a-way-to-disable-elm-optimize-level-2-in-elm-pages-build/8281/4 "2022-04-08T17:47:41Z")

</div>

Closed on April 8, 2022, 5:47pm UTC

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.
