esbuild-plugin-elm icon indicating copy to clipboard operation
esbuild-plugin-elm copied to clipboard

Use async version of elm compiler to be able to get the error message

Open rogeriochaves opened this issue 3 years ago • 3 comments

I want to be able to display the error message on the screen, for that I need to capture the error message produced during a compilation error, but this is not possible because the sync function from node-elm-compiler returns just a hardcoded string, as you can see here: https://github.com/rtfeldman/node-elm-compiler/pull/110

Since we are already in an async function, we might as well just use await here and get the proper error message

rogeriochaves avatar Jun 19 '22 07:06 rogeriochaves

Unfotunately, as mentioned in #2, this can result in compilation failing occasionally due to corrupt builds.

I want to be able to display the error message on the screen

Can you elaborate a bit on this? The error messages generated by elm are piped through to stderr so not sure what you mean by this.

phenax avatar Jun 19 '22 08:06 phenax

@phenax when I'm focusing on build the UI, I rely on hot reloading to refresh the screen, having just the code and the browser open side by side, so I wanted to display the errors in the DOM directly (like phoenix does when there is a backend error), with an overlay, not having to switch to the terminal

rogeriochaves avatar Jun 23 '22 07:06 rogeriochaves

@rogeriochaves As mentioned in #2, this could lead to broken builds so I think this issue should be fixed upstream instead.

phenax avatar Jun 23 '22 08:06 phenax