eleventy: Error-out on failure with `eleventy --serve`

Since eleventy --serve continues to attempt to generate output and does not error-out on failures, I’m often confused by how my changes don’t seem to reflect in the output. I use hotel, which displays a clear error message in the browser when attempting to access the site after the server crashes with an non-zero error code.

Having eleventy --serve error-out on failure (at least by default) would be awesome.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 5
  • Comments: 17 (10 by maintainers)

Commits related to this issue

Most upvoted comments

Here is @stowball’s comment from #542 (hopefully we can combine his issue with this one):


Currently, unless you’re watching the terminal output on every save, you have no idea if you’ve accidentally introduced a syntax error to your templates because for all intents and purposes, the browser reloads and appears to have worked. Unfortunately, it just reloads with the last good, cached version, which then causes extra frustration as you try to debug new code which you think should be rendered, but isn’t.

Here’s an example of what happens on an “unsuccessful” save:

File changed: _includes/components/header/link-level-1.ejs
Problem writing Eleventy templates: (more in DEBUG output)
> Having trouble rendering ejs template ./style-guide/header.ejs (TemplateContentRenderError)
> ./style-guide/header.ejs:2
    1|
 >> 2| <%- include('../_includes/components/header/index'); %>

…

Processed 0 files in 0.03 seconds
Watching…
[Browsersync] Reloading Browsers...

which, apart from the number of files processed, is essentially the same as what happens on a successful save.

What I’d like to see is something like what Create React App does, where the error is logged to both the terminal and the browser, like this:

image

I wonder how much effort it is to integrate a tool like node-notifier to throw an OS notification on error?

Oh I didn’t even notice it was broken. Lol. I’ll see if I can fix it soonish.