Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TemplateWriterError reports the wrong template #722

Closed
fredrikekelund opened this issue Oct 8, 2019 · 0 comments · Fixed by #724
Closed

TemplateWriterError reports the wrong template #722

fredrikekelund opened this issue Oct 8, 2019 · 0 comments · Fixed by #724
Labels
Milestone

Comments

@fredrikekelund
Copy link

Describe the bug
TemplateWriterErrors thrown by TemplateWriter#write report the wrong template as the source of the error.

To Reproduce
In my case, the eleventy-plugin-cache-buster was throwing an error because an asset hadn't been written to the output folder before the plugin's transform function was run.

However, this loop in TemplateWriter.js doesn't create a new scope to remember the value of the mapEntry variable with each loop iteration.

Expected behavior
The correct template should be reported. This could be solved by somehow creating a new scope with each loop iteration in the above mentioned loop.

Environment:

  • OS and Version: Mac
  • Eleventy Version 0.9.0
fredrikekelund pushed a commit to fredrikekelund/eleventy that referenced this issue Oct 9, 2019
Fixes 11ty#722. Previously we wouldn't scope the value of the mapEntry
variable to each iteration when looping over the templates to write.
This became an issue of any of the generated promises threw an error,
since the error message would always report that it stemmed from the
template from the last iteration.
@zachleat zachleat added bug and removed needs-triage labels Nov 6, 2019
@zachleat zachleat added this to the Next Minor Version milestone Nov 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants