terkelg/prompts

provide ESM package for cli development

HerbertHe opened this issue · 1 comments

Is your feature request related to a problem?

Ex. I'm always frustrated when I try to write a cli tool. With the development of nodejs, ESM has been supported, more and more packages only support ESM format importing now. So, here I got the following error, when I try to run the built cli tool.

file:///F:/Projects/cli/bin/cli.mjs:27
  throw new Error('Dynamic require of "' + x + '" is not supported');
        ^

Error: Dynamic require of "readline" is not supported
    at file:///F:/Projects/cli/bin/cli.mjs:27:9
    at node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/lib/elements/prompt.js (file:///F:/Projects/cli/bin/cli.mjs:3130:20)
    at __require2 (file:///F:/Projects/cli/bin/cli.mjs:33:50)
    at node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/lib/elements/text.js (file:///F:/Projects/cli/bin/cli.mjs:3193:18)
    at __require2 (file:///F:/Projects/cli/bin/cli.mjs:33:50)
    at node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/lib/elements/index.js (file:///F:/Projects/cli/bin/cli.mjs:4976:19)
    at __require2 (file:///F:/Projects/cli/bin/cli.mjs:33:50)
    at node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/lib/prompts.js (file:///F:/Projects/cli/bin/cli.mjs:4995:14)
    at __require2 (file:///F:/Projects/cli/bin/cli.mjs:33:50)
    at node_modules/.pnpm/prompts@2.4.2/node_modules/prompts/lib/index.js (file:///F:/Projects/cli/bin/cli.mjs:5059:20)

Describe the solution you'd like

Maybe the ESM format package was exported would fix this error?