index.ts:
import ora from 'ora'
const spinner = ora('Starting...').start()
spinner.succeed('Done!')
run tsup index.ts --format cjs,esm && node dist/index.js
and get error:
var import_ora = __toESM(require("ora"));
^
Error [ERR_REQUIRE_ESM]: require() of ES Module /Users/zhangjiawei/Desktop/github-downloader/node_modules/.pnpm/[email protected]/node_modules/ora/index.js from /Users/zhangjiawei/Desktop/github-downloader/dist/index.js not supported.
Instead change the require of /Users/zhangjiawei/Desktop/github-downloader/node_modules/.pnpm/[email protected]/node_modules/ora/index.js in /Users/zhangjiawei/Desktop/github-downloader/dist/index.js to a dynamic import() which is available in all CommonJS modules.
at Object.<anonymous> (/Users/zhangjiawei/Desktop/github-downloader/dist/index.js:47:26) {
code: 'ERR_REQUIRE_ESM'
}
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too