bullmq: bullmq@1.56.0: SyntaxError: Named export 'Queue' not found
Upgrading BullMQ from 1.55.1 to 1.16.0 results in this error:
import { Queue } from 'bullmq'
^^^^^
SyntaxError: Named export 'Queue' not found. The requested module 'bullmq' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:
import pkg from 'bullmq';
const { Queue } = pkg;
Changing my code to this worked indeed, but it’s not ideal:
import bull from 'bullmq'
const { Queue } = bull;
I can’t find which commit caused it, but it would be nice to have this fixed.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 5
- Comments: 27 (16 by maintainers)
Commits related to this issue
- chore: downgrade typescript to 3.9.10 fixes #917 — committed to taskforcesh/bullmq by manast 3 years ago
- fix: downgrade typescript to 3.9.10 fixes #917 (#960) — committed to taskforcesh/bullmq by manast 3 years ago
- chore(release): 1.59.4 [skip ci] ## [1.59.4](https://github.com/taskforcesh/bullmq/compare/v1.59.3...v1.59.4) (2021-12-21) ### Bug Fixes * downgrade typescript to 3.9.10 fixes [#917](https://github... — committed to taskforcesh/bullmq by semantic-release-bot 3 years ago
This is in a project not using TS at all, but ES imports.
Not sure, but I will revert because ESM is just broken and trying to enable it just hurts current users. For anybody wanting to use ESM this is the only known way to do it properly: https://blog.taskforce.sh/using-typescript-with-bullmq/
I can confirm it’s fixed now, thanks @manast! Still weird that TS4 breaks these imports, there should be a workaround/fix on TS4.
It might be related to the TS 3->4 bump in https://github.com/taskforcesh/bullmq/commit/d2897ee7bbf4aee5251ac4fb28705f2bebbe7bfe