-
I'm looking forward to Eleventy 3.0 and the (optional) switch to ESM. I think I've got a handle on it as an end user of Eleventy — but I'm wondering how best to plan ahead and support that transition as a plugin author. Questions like:
I'm just trying to get these questions straight in my own head, and I suspect others might be too! If anyone has thoughts on how best to tackle this, I'm all ears. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
I wouldn’t double-publish any plugins as ESM/CJS hybrids if I were you, it just seems like a headache moving forward (let’s move to ESM-only, slowly) One more point I would note: Eleventy plugins written in ESM could be made to work in Eleventy v2 using |
Beta Was this translation helpful? Give feedback.
.cjs
config file.import
a CommonJS package as-is in Node.js)await import()
instead ofrequire()
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-commonjsI wouldn’t doubl…