My program is in Typescript and I'm compiling to use CommonJS native ("module": "commonjs", in my tsconfig)
➜ test cat index.js
const pLimit = require("p-limit")
console.log(pLimit)
resulting to an error at runtime
➜ test node index.js
/home/portal/test/index.js:1
const pLimit = require("p-limit")
^
Error [ERR_REQUIRE_ESM]: require() of ES Module /home/portal/test/node_modules/p-limit/index.js from /home/portal/test/index.js not supported.
Instead change the require of /home/portal/test/node_modules/p-limit/index.js in /home/portal/test/index.js to a dynamic import() which is available in all CommonJS modules.
at Object.<anonymous> (/home/portal/test/index.js:1:16) {
code: 'ERR_REQUIRE_ESM'
}
With 3.x
program is working
➜ test node .
[Function: pLimit]
Is the support lost, or am I using the lib wrongly?
Hello, I was running p-limit@3 and tried to upgrade to p-limit@4
Reproduce error
My program is in Typescript and I'm compiling to use CommonJS native (
"module": "commonjs",
in my tsconfig)resulting to an error at runtime
With 3.x
program is working
Is the support lost, or am I using the lib wrongly?