sindresorhus / p-limit

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

Error: code: 'ERR_REQUIRE_ESM' in TS #65

Closed julianblanco00 closed 2 years ago

julianblanco00 commented 2 years 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 2 years ago

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

strowk commented 2 years 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 9 months ago

Same here using v5. Downgrading to v3 worked.