ampproject/eleventy-plugin-amp

[BUG] ReferenceError: options is not defined in src/.eleventy.js

Closed this issue · 3 comments

Bug Description

In a recent release of 0.2.0, we introduced filter option to only process matched files. But accidentally, the .eleventy.js was also modified which caused this bug.

module.exports = {
-  configFunction: (eleventyConfig, options) => {
+  configFunction: (eleventyConfig, providedOptions) => {
    addAmpTransform(eleventyConfig, options);

As we can see the options is replaced with providedOptions in the function arguments but not in the calls to other plugin functions.

Possible Solution

Simply reverting the change will fix the issue i.e.

module.exports = {
-  configFunction: (eleventyConfig, providedOptions) => {
+  configFunction: (eleventyConfig, options) => {
    addAmpTransform(eleventyConfig, options);

PR #22

@sebastianbenz Please have a look.

This has been published in 0.2.1 - thanks again for fixing!

Thank you for this awesome plugin. ❤️