haskellyesod

yesod devel does not rebuild when pressing enter and does not shut down properly


I'm having a few issues with Yesod's development server after following the Yesod Quick start guide:

EDIT In addition to the accepted answer, my static files weren't reloading because Yesod apparently serves static files with a Cache-Control header even in local development. So, doing a hard refresh got them loading in the browser.


Solution

  • Your first issue appears to be a long-standing yesod-bin bug. Commit b3ed4613 puts the stack build --file-watch process in its own process group which then gets stopped by job control when it tries to read user commands from standard input. The commit is 5 years old; no idea why it hasn't been reported before now.

    I filed issue #1860 that explains the problem and offers a suggested solution.

    In the meantime, you can build and install your own yesod-bin package with the following patch which seems to fix the problem for me.

    diff --git a/Devel.hs b/Devel.hs
    index a871463..325416b 100644
    --- a/Devel.hs
    +++ b/Devel.hs
    @@ -351,7 +351,6 @@ devel opts passThroughArgs = do
             myPath <- getExecutablePath
             let procConfig = setStdout createSource
                            $ setStderr createSource
    -                       $ setCreateGroup True -- because need when yesod-bin killed and kill child ghc
                            $ proc "stack" $
                     [ "build"
                     , "--fast"
    

    Hopefully, as you suspect, your other issues are related to this first issue.