sindresorhus / p-queue

Promise queue with concurrency control
MIT License
3.39k stars 182 forks source link

TypeError: PQueue is not a constructor #186

Closed nunoplima closed 12 months ago

nunoplima commented 1 year ago

Hi everyone!

I'm using "@tanstack/query-broadcast-client-experimental": "4.29.5" which uses broadcast-channel and p-queue under the hood, everything is working as expected but I do get an error: error - unhandledRejection: TypeError: PQueue is not a constructor at _callee16$ (file:///[path-to-app]/node_modules/@tanstack/query-broadcast-client-experimental/node_modules/broadcast-channel/dist/esnode/methods/node.js:570:29)

Do you have in idea on how to fix this issue?

Here's a reproducible example: https://codesandbox.io/p/sandbox/ecstatic-dhawan-urkt30?file=%2Fpages%2F_app.tsx%3A1%2C1

Many thanks in advance

sindresorhus commented 12 months ago

Your project needs to be ESM.

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