Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hotreloading for Elm submodules doesn't work after compilation error #7557

Closed
zkrzyzanowski opened this issue Jan 14, 2022 · 1 comment
Closed

Comments

@zkrzyzanowski
Copy link

馃悰 bug report

Prior to upgrading to Parcel 2, any changes to .elm files would force a hot reload/compile. After upgrading to parcel 2.2.0, only changes to Main.elm will compile after a compile error has occurred. Any files imported by Main.elm will not reload after a compile error.

馃帥 Configuration (.babelrc, package.json, cli command)

index.html

<!DOCTYPE html>
<div id="root"></div>
<script type="module" src="index.ts"></script>

index.ts

import { Elm } from "./Main.elm";

Elm.Main.init({ node: document.getElementById("root") });

Main.elm

module Main exposing (..)

import Browser
import Html exposing (Html)
import SubModule

main =
  Browser.sandbox { init = init, update = update, view = view }

type alias Model = Int

init : Model
init =
  0

type Msg = NoOp

update : Msg -> Model -> Model
update msg model =
  case msg of
    NoOp ->
      model


view : Model -> Html Msg
view model =
  SubModule.view

Submodule.elm

module SubModule exposing (..)
import Html exposing (Html)

view : Html msg
view = 
    Html.div [] [Html.text "sub mod"]

package.json

{
  "name": "my-app",
  "devDependencies": {
    "@parcel/packager-raw-url": "^2.2.0",
    "@parcel/transformer-elm": "^2.2.0",
    "@parcel/transformer-webmanifest": "^2.2.0",
    "elm": "^0.19.1-5",
    "parcel": "^2.2.0",
    "posthtml-expressions": "^1.9.0",
    "typescript": "^4.5.4"
  }
}

Steps to reproduce

  • Force a compile error in Submodule.elm, i.e.
module SubModule exposing (..)
import Html exposing (Html)

view : Html msg
view = 

  • Save
  • See compile error in browser
  • Fix compiler error
  • Save

馃 Expected Behavior

  • Elm recompiles and browser reloads page successfully

馃槸 Current Behavior

  • Elm doesn't recompile and the error message is still displayed even after it's been fixed

馃拋 Possible Solution

馃敠 Context

馃捇 Code Sample

https://github.com/zkrzyzanowski/parcel-elm-bug

馃實 Your Environment

Software Version(s)
Parcel 2.2.0
Node 16.3.0
npm/Yarn npm 8.1.0
Operating System MacOS 11.6
@mischnic
Copy link
Member

Duplicate of #6124
Pending PR: #7547

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants