elm-spa icon indicating copy to clipboard operation
elm-spa copied to clipboard

elm-spa build doesn't work

Open yiar opened this issue 4 years ago • 1 comments

% elm-spa build ! elm-spa failed to understand an error Please report the output below to https://github.com/ryannhg/elm-spa/issues

{}

! elm-spa failed to understand an error Please send the output above to https://github.com/ryannhg/elm-spa/issues

I asked for help at the slack, but nothing has worked so far. https://elmlang.slack.com/archives/C192T0Q1E/p1629297057122200

I'm not sure why. I used the beta for 6.0.0 for a while, then didn't update until today. So maybe it is because of that for some reason?

elm-spa server works fine!

yiar avatar Aug 18 '21 15:08 yiar

Following antew's advice I added an error log in the build.js file and then got this message when doing the elm-spa build command:

Error Error: Compilation failed {"type":"error","path":null,"title":"DEBUG REMNANTS","message":["There are uses of the Debugmodule in the following modules:\n\n ",{"bold":false,"underline":false,"color":"RED","string":"Pages.Home_"},"\n\nBut the --optimize flag only works if allDebugfunctions are removed!\n\n",{"bold":false,"underline":true,"color":null,"string":"Note"},": The issue is that --optimize strips out info needed byDebugfunctions.\nHere are two examples:\n\n (1) It shortens record field names. This makes the generated JavaScript is\n smaller, butDebug.toStringcannot know the real field names anymore.\n\n (2) Values liketype Height = Height Floatare unboxed. This reduces\n allocation, but it also means thatDebug.toStringcannot tell if it is\n looking at aHeightorFloatvalue.\n\nThere are a few other cases like that, and it will be much worse once we start\ninlining code. That optimization could moveDebug.logandDebug.todo calls,\nresulting in unpredictable behavior. I hope that clarifies why this restriction\nexists!"]} at ChildProcess.<anonymous> (/opt/homebrew/lib/node_modules/elm-spa/node_modules/node-elm-compiler/dist/index.js:131:35) at ChildProcess.emit (node:events:369:20) at maybeClose (node:internal/child_process:1067:16) at Socket.<anonymous> (node:internal/child_process:453:11) at Socket.emit (node:events:369:20) at Pipe.<anonymous> (node:net:665:12)

Turns out I forgot a "Element.explain Debug.todo" from Elm-ui. Would be nice if the elm-spa CLI could understand that and warn! :)

yiar avatar Aug 18 '21 15:08 yiar