Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CommonJS support #40

Closed
lmmfranco opened this issue Sep 2, 2021 · 1 comment
Closed

CommonJS support #40

lmmfranco opened this issue Sep 2, 2021 · 1 comment

Comments

@lmmfranco
Copy link

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
Copy link
Owner

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants