sindresorhus/ora

Can't be use with ES Modules

Closed this issue · 2 comments

getting an error when I try to run the ora on my ts project

Error [ERR_REQUIRE_ESM]: require() of ES Module C:\Projects\apix-js\@apixjs\api\node_modules\.pnpm\ora@8.0.1\node_modules\ora\index.js from C:\Projects\apix-js\@apixjs\api\lib\plugins\ora.ts not supported.
Instead change the require of index.js in C:\Projects\apix-js\@apixjs\api\lib\plugins\ora.ts to a dynamic import() which is available in all CommonJS modules.
    at require.extensions.<computed> [as .js] (C:\Projects\apix-js\@apixjs\api\node_modules\.pnpm\ts-node@10.9.2_@types+node@20.14.2_typescript@5.4.5\node_modules\ts-node\dist\index.js:851:20)
    at C:\Projects\apix-js\@apixjs\api\lib\plugins\ora.ts:35:65
    at async initPlugin (C:\Projects\apix-js\@apixjs\api\lib\plugins\ora.ts:35:17) {
  code: 'ERR_REQUIRE_ESM'
}

Great package, but the fact that the maintainers have to be soooo edgy they refuse to support CJS is a huge bummer.

I'm using Node 22 with experimental ESM requires and it's still a PITA to get this running. What a shame. Wish y'all had a different mindset. It's really not that hard to add SWC and transpile into CJS.