Post #1285494
2026-04-17 17:34 UTC
Anyone know how to use commonjs plugins with an ESM config in #eleventy / #11ty? I am using import for everything, but there's one plugin that I'd like to use that is still using commonjs. Specifically: https://www.npmjs.com/package/eleventy-plugin-nesting-toc?activeTab=readme
Replies (1)
-
@zachleat@fediverse.zachleat.com 2026-04-17 19:23
@nathanu even on older versions of Node you should be able to import "CommonJS" directly. The only case that requires special care is require("ESM") (and for that you can use Node 22 or newer) Looking at https://www.11ty.dev/docs/cjs-esm/ I’m noting that maybe I didn’t call that out clearly enough!