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

Problems importing eleventy-plugin-rss v2.0 via a custom plugin #52

Closed
nathan-bottomley opened this issue Jun 15, 2024 · 4 comments
Closed
Labels
bug Something isn't working

Comments

@nathan-bottomley
Copy link

I'm playing around with updating to version 2.0 of eleventy-plugin-rss. (I'm on Eleventy 3.0.0-alpha.13.)

I have a podcast plugin which I've written, which imports and adds eleventy-plugin-rss. That podcast plugin is imported and added to the main config file. I also have a nunjucks template which uses the filters supplied by eleventy-plugin-rss.

All this worked fine with eleventy-plugin-rss v1.x. With eleventy-plugin-rss v2.0, the filters don't get added to the main config.

[11ty] 1. Having trouble rendering njk template ./podcast.njk (via TemplateContentRenderError)
[11ty] 2. (./podcast.njk)
[11ty]   Error: filter not found: dateToRfc3339 (via Template render error)

However, if I add the podcast plugin to the main config file with { immediate: true }, everything works fine.

Here's a minimal repository illustrating the problem: https://github.com/nathan-bottomley/rss-test

I know that some changes have been made to the way plugin imports work, so I'm imagining that it's something to do with that. Having to add { immediate: true } isn't such an imposition: I'm just not sure if that's how things are meant to work.

@zachleat zachleat added the bug Something isn't working label Jun 17, 2024
@zachleat zachleat added this to the Eleventy RSS Plugin v2.0.2 milestone Jun 17, 2024
@zachleat
Copy link
Member

The RSS plugin swapped to an async plugin in v2.0.0 but I don’t think it was necessary to do so. I’m going to move it back to a synchronous plugin in v2.0.2. However, this will require a change in core, so it will have to wait for 2.0.0-canary.14.

In the mean time, the workaround is to await on the addPlugin call for the rss plugin, like so:

import rssPlugin from '@11ty/eleventy-plugin-rss'

export default async function(eleventyConfig) {
  await eleventyConfig.addPlugin(rssPlugin)
}

@zachleat
Copy link
Member

Apologies, I flubbed this one on -alpha.14. It’ll go up with core v3.0.0-alpha.15.

@zachleat
Copy link
Member

Shipping with 2.0.2

@zachleat
Copy link
Member

2.0.2 has shipped https://github.com/11ty/eleventy-plugin-rss/releases/tag/v2.0.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants