sindresorhus / p-limit

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

v5 does not work with bunjs: Cannot find package "#async_hooks" #76

Closed btakita closed 3 months ago

btakita commented 7 months ago

Using the following works with bunjs:

import {AsyncResource} from 'node:async_hooks';
JonathonRP commented 7 months ago

same issue with deno

adxzhang1 commented 6 months ago

Im also seeing this with esbuild when importing plimit

firxworx commented 6 months ago

FYI package imports with # prefix are NodeJS subpath imports: https://nodejs.org/api/packages.html#subpath-imports

I reported the following issue earlier which appears related: https://github.com/sindresorhus/p-limit/issues/75 (also see the related issue linked there re nodejs itself)

I honestly wonder a bit how @sindresorhus hasn't hit this issue himself now that it seems like a huge chunk of the ecosystem is impacted!

lerman01 commented 6 months ago

This issue reproduced also when trying to run typescript apps with ts-node

jdmarshall commented 5 months ago

https://github.com/oven-sh/bun/pull/3089 seems related

GerroDen commented 5 months ago

Same issue with jest and SWC transpilation:

import pLimit from "p-limit";

pLimit(100)(async () => "test");

Leads to this error:

no such file or directory, open 'async_hooks'

And it doesn't matter what I change in tsconfig or jest.config to use ESM or ignore transpilation.

harrytran998 commented 5 months ago

Hmm - Hope anyone can resolve this soon.

KubaJastrz commented 3 months ago

Bun has fixed this on their end. Works for me (tested on bun v1.0.30).

https://github.com/oven-sh/bun/issues/7488

jdmarshall commented 3 months ago

@sindresorhus I think there are a couple duplicates of this issue in the tracker. Heads up.