sindresorhus / p-limit

Run multiple promise-returning & async functions with limited concurrency
MIT License
1.84k stars 99 forks source link

Error: code: 'ERR_REQUIRE_ESM' in TS #65

Closed julianblanco00 closed 1 year ago

julianblanco00 commented 1 year ago

Hi, I have the following code

import pLimit from 'p-limit' const limit = pLimit(8)

And I receive an error in my console: var _pLimit = _interopRequireDefault(require("p-limit"));

sindresorhus commented 1 year ago

https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c

strowk commented 1 year ago

I am getting this error even by using import pLimit from 'p-limit';

simplenotezy commented 1 year ago

Same here - can't use p-limit in a nest.js framework

simplenotezy commented 1 year ago

Switched to version 3 solves the issue for now

TomlDev commented 4 months ago

Same here using v5. Downgrading to v3 worked.