Closed
Description
Hello 👋
The package cliui
remove "some" colors when working with ESM. Everything is fine with CJS. I found the problem on a CLI project I just migrated and I couldn't understand why my colors were not working anymore.
I'm working on Windows 10 and Node.js v16
How to reproduce:
$ mkdir cliui_bug
$ cd cliui_bug
$ npm init -y
$ npm i kleur cliui -P
# Add type: module in package.json
The index.js file
import kleur from "kleur";
import cliui from "cliui";
// const kleur = require("kleur");
// const cliui = require("cliui");
const { white, cyan, red } = kleur;
const ui = cliui();
const title = `${white().bold("name:")} ${cyan().bold("express")}`;
console.log(title);
ui.div(
{ text: title, width: 50 }
);
ui.div({ text: red("-------------------------------------------------------------------"), width: 70 });
console.log(ui.toString());
The title with cliui doesn't work. If you switch the project to CJS it will work as expected.
Best Regards,
Thomas