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

Most upvoted comments

Interesting… did you test by upgrading your local typescript version too? Could it be that typescript introduced an incompatibility between version 3 and 4?

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/

ok, after a lot of frustration and testing I had finally nailed down this to actually typescript 4. It just breaks the module system, I do not understand how this is possible but downgrading to 3.9.10 solves the issue nicely and no matter what I try with version 4+ it just does-not-work…

I can confirm it’s fixed now, thanks @manast! Still weird that TS4 breaks these imports, there should be a workaround/fix on TS4.