Closed alaindeurveilher closed 1 year ago
This is a problem with Next.js. This package is just using sub-path imports. Open an issue on Next.js instead.
Issue created on Next.js: https://github.com/vercel/next.js/issues/58052
It is not an issue with nextjs. We use p-limit is a TypeScript backend project and face the same issue in our unit tests.
We are running on node18 What is the root cause of this?
I created a repo to reproduce: https://github.com/andrmoel/async-hooks-test
Description is in the README.md
@andrmoel p-limit
is a ESM module, so you need to use the correct TypeScript config. This has nothing specifically to do with this package.
Add "module": "node16", "moduleResolution": "node16" to your tsconfig.json. (Example)
@sindresorhus It doesn't work. I don't want to make my package a module just because it uses p-limit.
I can add node16
to my tsconfig but it won't change anything.
PR: https://github.com/andrmoel/async-hooks-test/pull/1
Check the run: https://github.com/andrmoel/async-hooks-test/actions/runs/6769536794/job/18396108036
Please clone my repo and try yourself
I don't want to make my package a module just because it uses p-limit.
Please read: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c#pure-esm-package
Hi,
Since the update of v5.0.0 (updating from 4.0.0) I now get the following error:
My environment is NextJS 14, Node JS 20.8.0
I did not have the issue with pLimit v4.0.0
I see in the diff between 4.0.0 and 5.0.0 a new line for the usage of
import {AsyncResource} from '#async_hooks';
so the error is definitely coming from this update.
I also read a warning on the NodeJS webpage version 21.1 about the usage of async_hook: source: https://nodejs.org/api/async_hooks.html
Is it safe to be used then? Is this API compatible with node 20 and below ?
Thank you.