CommonJS support
lmmfranco opened this issue · 1 comments
lmmfranco commented
The lib doesn't work with node out of the box. To require with commonjs we have to do some wizardry like this:
(async () => {
const terminalImage = (await import("terminal-image")).default;
console.log(await terminalImage.file('pikachu.png'));
})();
While requiring a commonjs lib on a ESM file is quite simple:
import someCommonJsLib from "some-commonjs-lib";
Consider reverting back to common js.
Anyway, thanks for the wonderfull library.
sindresorhus commented
I don't plan to move back to CommonJS. I recommend staying on the previous version if ESM is a problem for you.
https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c