GetStream/stream-chat-angular

Module 'uuid' not found in stream-chat-angular: Suggest using native crypto.randomUUID();

Closed this issue ยท 7 comments

Hi StreamChat Team,

I encountered an issue when building my Angular project with the stream-chat-angular package. The error message indicates that the 'uuid' module is not found:

./node_modules/stream-chat-angular/fesm2015/stream-chat-angular.js:7:0-26 - Error: Module not found: Error: Can't resolve 'uuid' in 'D:\Projects\AnimeSector\node_modules\stream-chat-angular\fesm2015'

To resolve this, I had to manually add 'uuid' to my project's package.json. It would be beneficial if the 'uuid' dependency were included in the stream-chat-angular package.json, or even better, if you could use the native crypto.randomUUID() method:

let uuid = self.crypto.randomUUID();

This would reduce external dependencies and leverage built-in functionality for generating UUIDs. Its well supported: https://caniuse.com/mdn-api_crypto_randomuuid

Thank you for considering this improvement!

Best regards

Thanks for reporting the issue. It seems we have a bug and specify uuidv4 as a dependency, but import from uuid. The issue is probably masked for most people because uuidv4 installs uuid, and the code works as long as node_modules has a specific structure. But of course, we should definitely fix this, added to our backlog.

As for using the crypto API: thanks for the tip, it does seem to have a good browser support now.

I noticed that the same issue occurs with @ngx-translate/core. It would be great if you could include it as a proper dependency within the library.

@ngx-translate/core is a peer dependency because you can't have multiple versions of it installed in your project, so you have to install it yourself (https://getstream.io/chat/angular/tutorial/)

Hmm I use only the services and definitions from stream-chat-angular. It fells a bit strange to have ngx-translate and transloco at the same time in my package.json ๐Ÿ˜…

I expected the services, definitions, pipes etc in something like stream-chat-angular-core and the UI Components in something like stream-chat-angular-components. but yeah. if everything is in the same package, we need also the translation package that is used in the Components.

In the end we won't be using crypto API just yet, because we would lose support for Safari 15-15.3, versions that we otherwise support.

๐ŸŽ‰ This issue has been resolved in version 4.66.6 ๐ŸŽ‰

The release is available on:

Your semantic-release bot ๐Ÿ“ฆ๐Ÿš€

๐ŸŽ‰ This issue has been resolved in version 5.0.0-v5.17 ๐ŸŽ‰

The release is available on:

Your semantic-release bot ๐Ÿ“ฆ๐Ÿš€