Eleventy » Use ES modules
Eleventy doesn’t currently support importing ES modules, and you can’t easily bridge the gap between CJS and ESM because ES importing is async and CJS is synchronous.
To work around it, you can use the require-esm-in-cjs package:
eleventy.config.cjs:
const req = require('require-esm-in-cjs');
module.exports = req(`${__dirname}/eleventy.config.mjs`)
eleventy.config.mjs:
export default function (eleventyConfig) {
// ...
}