console-table-printer icon indicating copy to clipboard operation
console-table-printer copied to clipboard

ECMA instead of commonJS

Open ayonious opened this issue 6 months ago • 2 comments

Currently this is only usable with commonJS. We need ECMA as well or ONLY ECMA

ayonious avatar Jun 12 '25 07:06 ayonious

instead const Table = require('..');

import ConsoleTablePrinter from 'con..'l

ayonious avatar Jun 12 '25 07:06 ayonious

@ayonious The lib takes care of ensuring that it still works with quite a few no longer supported Node versions (14, 16, 18, 20).

Is this still a requirement?

Another potential approach would be to narrow that done to 20.19+

Indeed, since Node 20.19+, it's now possible to "require()" an ESM module.

Which would allow to switch to ESM and still allow commonjs based consumer to require the lib.

Do you have any kind of view of the % of users of this lib per Nodejs version? How much would it hurt to stop supporting 14/16/18?

Relevant:

  • https://joyeecheung.github.io/blog/2024/03/18/require-esm-in-node-js/
  • https://socket.dev/blog/require-esm-backported-to-node-js-20

nulltoken avatar Oct 09 '25 18:10 nulltoken