KiwiKilian / eleventy-plugin-og-image

Create Open Graph images in Eleventy using your templates, data and CSS. Fast and reproducible, without a headless browser.
MIT License
52 stars 3 forks source link

fix: undefined export from eleventy package #267

Closed chrisburnell closed 1 month ago

chrisburnell commented 1 month ago

I curiously started running into the following error today:

Package subpath './src/Plugins/RenderPlugin.js' is not defined by "exports" in path/node_modules/@11ty/eleventy/package.json imported from path/node_modules/eleventy-plugin-og-image/src/OgImage.js

Original error stack trace: Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './src/Plugins/RenderPlugin.js' is not defined by "exports" in path/node_modules/@11ty/eleventy/package.json imported from path/node_modules/eleventy-plugin-og-image/src/OgImage.js
    at exportsNotFound (node:internal/modules/esm/resolve:299:10)
    at packageExportsResolve (node:internal/modules/esm/resolve:646:9)
    at packageResolve (node:internal/modules/esm/resolve:824:14)
    at moduleResolve (node:internal/modules/esm/resolve:914:18)
    at defaultResolve (node:internal/modules/esm/resolve:1119:11)
    at nextResolve (node:internal/modules/esm/hooks:791:28)
    at resolve (file://path/node_modules/@11ty/eleventy/src/Util/EsmResolver.js:25:11)
    at nextResolve (node:internal/modules/esm/hooks:791:28)
    at Hooks.resolve (node:internal/modules/esm/hooks:238:30)
    at handleMessage (node:internal/modules/esm/worker:255:24)

This PR aims to address this problem by instead importing RenderPlugin from @11ty/eleventy and then extracting File from RenderPlugin.

Apologies if I'm overlooking something obvious!

KiwiKilian commented 1 month ago

Thanks for the report! Which @11ty/eleventy version are you on? There were changes to the RenderPlugin in the latest alpha release where I already expected some hickups but didn't tested yet...

chrisburnell commented 1 month ago

Sorry, I should have mentioned. This is indeed happening with version 3.0.0-alpha.18.

Edit: I’ve just done a quick test and the changes in this PR appear to be working for both 3.0.0-alpha.17 and 3.0.0-alpha.18. Hope that helps.

chrisburnell commented 1 month ago

Updated package-lock.json and amended the previous commit message to refer to the correct alpha version!

github-actions[bot] commented 1 month ago

:tada: This PR is included in version 4.0.0-beta.8 :tada:

The release is available on:

Your semantic-release bot :package::rocket: