11ty / eleventy

A simpler site generator. Transforms a directory of templates (of varying types) into HTML.
https://www.11ty.dev/
MIT License
17.29k stars 496 forks source link

JSON circular reference error when using JSTL template #263

Closed zachleat closed 6 years ago

zachleat commented 6 years ago
Error writing templates: (full stack in DEBUG output)
> Having trouble writing template: _site/template/index.html (TemplateWriterWriteError)
> Converting circular structure to JSON (TypeError)
Processed 0 files in 0.12 seconds
elbotho commented 5 years ago

@zachleat when I try to run the example on jstl templates I get:

Problem writing Eleventy templates: (full stack in DEBUG output)
> Having trouble rendering template ./index.jstl (TemplateContentRenderError)
> Converting circular structure to JSON
    --> starting at object with constructor 'Object'
    |     property 'all' -> object with constructor 'Array'
    |     index 0 -> object with constructor 'Object'
    |     property 'data' -> object with constructor 'Object'
    --- property 'collections' closes the circle (TypeError)
Processed 0 files in 1.90 seconds

Probably the same bug? The version in the example is outdated ("@11ty/eleventy": "^0.5.4")

But even If I update ("@11ty/eleventy": "^0.8.3") it results in :

Problem writing Eleventy templates: (more in DEBUG output)
> ./index.jstl contains a circular reference (using collections) to its own templateContent. (UsingCircularTemplateContentReferenceError):
    UsingCircularTemplateContentReferenceError: ./index.jstl contains a circular reference (using collections) to its own templateContent.
        at TemplateMap.populateContentDataInMap (/Volumes/data/botho/Documents/Websites/SERLO/11ty_jstl_example/eleventy-sample-jstl/node_modules/@11ty/eleventy/src/TemplateMap.js:367:17)
Processed 0 files in 1.59 seconds

Im on OSX 10.13.6, node v12.1.0 and npm v6.9.0

Did the syntax change or something? I'm happy to try/change things and update the example if we find a solution 👍

elbotho commented 5 years ago

just checked even this minimal example as index.jstl fails:

---
title: My Template
---
test

also stable and latest node versions don't seem to change anything.

any ideas?