Closed JoseZamora97 closed 4 months ago
Hi, thanks for reporting!
I had received a similar report in https://github.com/Secreto31126/whatsapp-api-js/issues/300#issuecomment-1932130229, ~however, I'm seriously struggling to replicate the issue.~
While writting the comment I had a revelation, the bug is on the cjs side.
May I ask, are you using any compiler for your code, such as vite or esbuild?
I spent the last few hours reducing the possibilities and I managed to get a super small bug reproduction in a StackBlitz. Once I got the words to describe the problem I went to the esbuild repo and searched for similar issues:
https://github.com/evanw/esbuild/issues/2623
In other words, JS is broken and export default
has interoperability issues.
Option 1: Replace all default exports with named exports, requiring a breaking update for the library
Option 2: As mentioned in the issue, changing "type": "module"
before and after compiling should patch the problem
The first one hurts me because I really love the default
syntax and I don't want to let it go. However, the other option is painfully dumb and bug prone.
I will think it through this night and work on it tomorrow. Maybe it's time to start working on v3, I have a bunch of ideas in the workshop which I couldn't release because it required breaking changes :)
Describe the bug
Getting TypeError: Class extends value #
To Reproduce
Importing the
whatsappClient
created:Error:
Expected behavior
Import the object witout errors.
Desktop (please complete the following information):