sindresorhus/ora

typescript usage

Closed this issue · 3 comments

I'm having problem with using ora spinners in typescript. Is it possible to fix this problem:

Error [ERR_REQUIRE_ESM]: require() of ES Module

Using code right from example:

import ora from 'ora';

const spinner = ora('Loading unicorns').start();

setTimeout(() => {
        spinner.color = 'yellow';
        spinner.text = 'Loading rainbows';
}, 1000);

@dongalor please try this solution and let me know if it worked for you.
https://github.com/nooqta/esm-ts

A solution is to use version v5.4.1 of this library instead of the latest version (v6.0.0 has the breaking change with ESM)

@sindresorhus all the work you published in useful libraries is awesome, but that ESM shift on some of them is a pain for many developers. I guess you are tired of reading this, but making those libraries easily usable would be even more awesome 🙂