Skip to content

Any guidance for plugin authors on adding ESM support for Eleventy 3? #3126

Answered by zachleat
gfscott asked this question in Q&A
Discussion options

You must be logged in to vote
  • Existing plugins will work fine as-is in CommonJS projects and ESM projects with a .cjs config file.
  • Existing plugins will work fine as-is in ESM projects (you can import a CommonJS package as-is in Node.js)
  • If you upgrade your plugin to use ESM, this will be a breaking change (make sure you bump to a new major version when publishing) for CommonJS config files (but ESM config files will work without changes)—they’ll need to use await import() instead of require() for the plugin. This is the exact same as what we recommend for core Eleventy now (which exposes a few now-ESM plugins): https://www.11ty.dev/blog/canary-eleventy-v3/#how-to-require(@11ty/eleventy)-in-commonjs

I wouldn’t doubl…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@gfscott
Comment options

Answer selected by gfscott
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants