Replies: 2 comments
-
@grahamb If you can find any method that is able to bring ESM support to Bull and BullMQ without breaking for the users not using ESM, then I would gladly push for such a solution. I have spent a lot of time trying to find such a solution myself and unfortunatelly I have not found any way that works in all cases, on the contrary when trying to enable ESM most stuff breaks and it just opens a can of worms of incompatibilities in the NodeJS ecosystem. For me this is an issue with NodeJS, and until it gets fixed at its core I do not think there is a lot we can do here other than transpiling, which in practice is not that a big of a problem. |
Beta Was this translation helpful? Give feedback.
-
and also the solution needs to work with typescript, this was also another ingredient in the mix making stuff harder to solve unfortunatelly... |
Beta Was this translation helpful? Give feedback.
-
Neither Bull or BullMQ support ES Modules for sandboxed workers. I know that I can pass a path to a CommonJS file with a
.cjs
extension to thenew Worker
constructor, but that only works for the most simple workers that don't themselves import ES Modules.Are there any plans to support ES Modules for sandboxed workers? This seems like a pretty large issue now that ES Modules are becoming more widely supported in Node. Or am I stuck transpiling my ESM workers to CJS with Babel like the bad old days?
References:
https://blog.taskforce.sh/using-typescript-with-bullmq/ (advocates using the compiled JS versions)
https://github.com/taskforcesh/bullmq/pull/945/files (PR to add ESM support, open since December 2021)
OptimalBits/bull#2341 (similar PR on OptimalBits/bull)
Beta Was this translation helpful? Give feedback.
All reactions