Closed querkmachine closed 4 weeks ago
Looking!
I don’t think this pattern here is doing quite what you want (I see lots of them in your config file):
eleventyConfig.addPairedNunjucksShortcode(
"callout",
import("./config/shortcodes/callout.js")
);
I do think the pattern would work if it weren’t returning Promise { [Module: null prototype] { default: [Function: default] } }
.
This should work, but you’ll need to change all instances of the pattern:
eleventyConfig.addPairedNunjucksShortcode(
"callout",
(await import("./config/shortcodes/callout.js")).default
);
Personally, I think this looks a bit nicer though:
import calloutShortcode from "./config/shortcodes/callout.js";
export default async function(eleventyConfig) {
eleventyConfig.addPairedNunjucksShortcode("callout", calloutShortcode);
};
Improved the error messaging here for all Filter/Shortcode definitions for all template syntax types. It will now look like this:
~/Temp/eleventy-3286 (eleventy-esm ✘)✹ ᐅ npx @11ty/eleventy
[11ty] 1. Error in your Eleventy config file '.eleventy.js'. (via EleventyConfigError)
[11ty] 2. Invalid definition for "callout" Nunjucks Paired Shortcode. (via Error)
Thanks! That’ll ship with 3.0.0-alpha.15
Thanks for the fix! And extra thanks for the clearer error messaging!
Operating system
macOS Sonoma 14.0 (23A339)
Eleventy
3.0.0-alpha.10
Describe the bug
Using Eleventy 3.0.0-alpha.10, my website fails to compile Nunjucks files correctly, returning something akin to the following stack trace when debugging is enabled:
The Nunjucks filename and line/column numbers are frequently changing, and just appear to point to whatever file Eleventy is trying to process first.
The
callback.call
referenced in the error message appears to be internal to Eleventy.https://github.com/11ty/eleventy/blob/d30b952ad59e8978b22616797287fbb0fbfb332f/src/Template.js#L471-L480
As far as I've been able to gather:
{% block %}
s moves where the error is up until a point. It quickly seems to land on a page that lacks one, however.Notably, the content of this branch is identical with the main branch; except for having Eleventy 3.0.0-alpha.10 installed and the configuration & data files converted to ESM format.
All of the actual Nunjucks and Markdown files are untouched, so the issue would seem to lie in either Eleventy 3.0, the included version of Nunjucks, or some aspect of how I've migrated things.
Reproduction steps
Unfortunately due to the mysterious nature of the issue I was unable to create a reduced example.
npm ci
npx @11ty/eleventy
Expected behavior
Ideally, things would compile successfully!
If this is an obscure issue buried somewhere in Eleventy 3.0.0, this could be a barrier to upgrading and migration, which is why I'm raising it before it can (potentially) affect anyone else.
Reproduction URL
https://github.com/querkmachine/beeps.website/tree/eleventy-esm
Screenshots
No response