Zearin/eleventy-plugin-pug

Possible bug in `CustomEngine` with `this.entry`

Zearin opened this issue · 2 comments

The basic minimal test case is not working. :-(

As best as I can figure…

Inside Eleventy’s CustomEngine class, when it comes time to compile, this.entry exists but this.entry.compile is undefined.

A similar (but not identical) issue occured before the launch of Eleventy 2; see:
11ty/eleventy#2358

CC: @zachleat

ah, sorry—I’m a bit confused by this piece:

eleventyConfig.addExtension('pug', new EleventyPugExtension(eleventyConfig, options))

(not saying this is bad code, just that I’m not confident it’s supported)

In the custom type here, it expects an object literal, not a new class instance: https://www.11ty.dev/docs/languages/custom/

Whoopsie daisy! 🤦

Q: Is there a way to check whether a class instance is passed into addExtension()?

If so, Eleventy could throw an error at that earlier stage, to let future plugin authors know they are barking up the wrong tree :D