Gr0t3Man


No “Template render error” or rendering stops when a fault Nunjucks file is inside an if-statement

Operating system

Pop!_OS 22.04 LTS

Eleventy

3.0.0-alpha.10

Describe the bug

Normally Eleventy displays a error “Template render error” and stops processing the rendering when a Nunjucks file/block contains an error, for example is missing a {% endif %} statement.

When the faulty Nunjucks file is placed inside an if-statement, the template rendering is completed without any error. The code inside the faulty Nunjucks file is simply discharged and not rendered in the output file(s).

Reproduction steps

  1. Create a file mood.njk
{% if hungry %}
  I am hungry
{% elif tired %}
  I am tired
{% else %}
  I am good!
{% endfor %}
  1. add a include, inside a if-statement, to an layout file

     {% if tags == posts %}
       {% include 'mood.njk' %}
     {% endif %}
    
  2. start a eleventy build

Expected behavior

When a error is occurred inside an Nunjucks file it's expected that the rendering is stopped and a error is displayed.

Reproduction URL

No response

Screenshots

No response