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

fix: undefined export from eleventy package #267

Merged
merged 4 commits into from
Jul 31, 2024
Merged

fix: undefined export from eleventy package #267

merged 4 commits into from
Jul 31, 2024

Conversation

chrisburnell
Copy link
Contributor

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
Copy link
Owner

KiwiKilian commented Jul 31, 2024

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
Copy link
Contributor Author

chrisburnell commented Jul 31, 2024

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.

Copy link
Owner

@KiwiKilian KiwiKilian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your fix is great, thanks!

src/OgImage.js Outdated Show resolved Hide resolved
Copy link
Owner

@KiwiKilian KiwiKilian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok I've tested all alphas, the RenderPlugin export is available only from >=3.0.0.alpha.5. Could you change the following in package.json:

  • Raise @11ty.compatibility to >=3.0.0-alpha.5
  • Raise peerDependencies.@11ty/eleventy to >=3.0.0-alpha.5
  • Set devDependencies.@11ty/eleventy to 3.0.0-alpha.5 (should be exact version to test against the lowest allowed version in development/testing)

You can test within the repo with npm install and npm run example. It works with 3.0.0-alpha.5 but not 3.0.0-alpha.4.

Copy link
Owner

@KiwiKilian KiwiKilian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking great, you should have a release in a few minutes!

Copy link
Owner

@KiwiKilian KiwiKilian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

package-lock.json needs an update, please run npm install and commit.

@chrisburnell
Copy link
Contributor Author

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

@KiwiKilian KiwiKilian merged commit 4906d64 into KiwiKilian:beta Jul 31, 2024
5 checks passed
github-actions bot pushed a commit that referenced this pull request Jul 31, 2024
# [4.0.0-beta.8](v4.0.0-beta.7...v4.0.0-beta.8) (2024-07-31)

### Bug Fixes

* RenderPlugin.File import ([#267](#267)) ([4906d64](4906d64))
Copy link

🎉 This PR is included in version 4.0.0-beta.8 🎉

The release is available on:

Your semantic-release bot 📦🚀

github-actions bot pushed a commit that referenced this pull request Oct 5, 2024
# [4.0.0](v3.1.0...v4.0.0) (2024-10-05)

### Bug Fixes

* align logging paths ([5491207](5491207))
* allow empty options for mergeOptions ([380a3c3](380a3c3))
* generateHTML and outputURL capitalization ([5e911b0](5e911b0))
* generateHTML type ([f86acd4](f86acd4))
* hashes without special chars with hex digest ([47fb387](47fb387))
* join directories with output and preview dir ([155c7d8](155c7d8))
* outputUrl on windows with forward slash ([e1bff34](e1bff34)), closes [#234](#234)
* release ([8d74d25](8d74d25))
* RenderPlugin.File import ([#267](#267)) ([4906d64](4906d64))
* type imports ([24aa37b](24aa37b))
* update docs about arrow functions ([e6639e5](e6639e5)), closes [#239](#239) [#241](#241)
* use released alpha version ([bb8519c](bb8519c))

### Features

* add cache file path ([9b3a1d6](9b3a1d6))
* add caching ([17b46f3](17b46f3))
* add eleventyPluginOgImage data to rendering ([b63cc55](b63cc55)), closes [#215](#215)
* add exports ([263499b](263499b))
* add previewHtml ([7406914](7406914))
* allow OgImage custom class ([d31d320](d31d320))
* improve preview path handling ([4462d10](4462d10))
* improve types of this for function parameters ([5b0b269](5b0b269))
* pass instance as parameter ([b04eaf6](b04eaf6)), closes [#252](#252)
* pass shortcode scoped data to OG templates ([a240aee](a240aee)), closes [#211](#211)
* reduce recalculations ([6a69780](6a69780))
* release with npm provenance ([7123708](7123708))
* rename generateHTML to shortcodeOutput ([a5cd8fd](a5cd8fd))
* rename getOutputFileSlug to outputFileSlug ([3923a5c](3923a5c))
* set previewDir based on outputDir ([93906ec](93906ec))
* update dependencies ([75aae59](75aae59))
* upgrade eleventy depency to stable v3 ([6e96800](6e96800))
* upgrade sharp ([0fa8b23](0fa8b23))
* urlPath default to outputDir ([fe9d54f](fe9d54f))
* use fs promises ([0953dec](0953dec))

### BREAKING CHANGES

* outputFileSlug and shortcodeOutput options get OgImage instance as parameter instead of this
* rename getOutputFileSlug to outputFileSlug
* rename generateHTML to shortcodeOutput
* Plugin structure changed to OgImage class
* Options changed, consult docs before upgrading
Copy link

github-actions bot commented Oct 5, 2024

🎉 This PR is included in version 4.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants