-
-
Notifications
You must be signed in to change notification settings - Fork 44
Open
Description
I have the webc code:
<div class='post' webc:for="child of tocData.children">
<div>
<div @text="JSON.stringify(Object.keys(child))"/>
<a :href="`#${child.anchor}`" @text="child.text" />
</div>
</div>This works, and has that div with debugging data in it. If I remove that line and this becomes:
<div class='post' webc:for="child of tocData.children">
<div>
<a :href="`#${child.anchor}`" @text="child.text" />
</div>
</div>Then it breaks:
[11ty] Wrote 4 files in 2.18 seconds (544.9ms each, v4.0.0-alpha.6)
[11ty] Eleventy Fatal Error (CLI):
[11ty] 1. Having trouble writing to "./_site/docs/search/index.html" from "./src/docs/search.njk" (via EleventyTemplateError)
[11ty] 2. (./src/_includes/layouts/main.njk)
[11ty] EleventyNunjucksError: Error with Nunjucks paired shortcode `renderTemplate` (via Template render error)
[11ty] 3. Evaluating a dynamic attribute failed: `:href="`#${child.anchor}`"`.
[11ty] Original error message: Cannot read properties of undefined (reading 'anchor')
[11ty] 4. Cannot read properties of undefined (reading 'anchor') (via TypeError)
[11ty]
[11ty] Original error stack trace: TypeError: Cannot read properties of undefined (reading 'anchor')
[11ty] at Object.default (data:text/javascript;charset=utf-8,export%20default%20function(%7B%20child%20%7D)%20%7B%20return%20%60%23%24%7Bchild.anchor%7D%60%20%7D%3B:1:55)
[11ty] at file:///Users/tmcw/s/11ty-website/node_modules/@11ty/webc/src/attributeSerializer.js:197:15
[11ty] at process.processTicksAndRejections (node:internal/process/task_queues:103:5)
[11ty] at async AttributeSerializer.evaluateAttribute (file:///Users/tmcw/s/11ty-website/node_modules/@11ty/webc/src/attributeSerializer.js:191:21)
[11ty] at async Promise.all (index 0)
[11ty] at async AstSerializer.renderStartTag (file:///Users/tmcw/s/11ty-website/node_modules/@11ty/webc/src/ast.js:477:29)
[11ty] at async AstSerializer.compileNode (file:///Users/tmcw/s/11ty-website/node_modules/@11ty/webc/src/ast.js:1185:55)
[11ty] at async AstSerializer.getChildContent (file:///Users/tmcw/s/11ty-website/node_modules/@11ty/webc/src/ast.js:369:56)
[11ty] at async AstSerializer.compileNode (file:///Users/tmcw/s/11ty-website/node_modules/@11ty/webc/src/ast.js:1279:36)
[11ty] at async AstSerializer.getChildContent (file:///Users/tmcw/s/11ty-website/node_modules/@11ty/webc/src/ast.js:369:56)
It also breaks if I switch from self-closing to <div></div> syntax for the debugging line.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels