Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hotfix: error crypto with angular 19 #509

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

cgrodriguezt
Copy link

imagen
Issue:

After updating Angular to version 19, I encountered the following error:

ts
Copiar código
TS2307: Cannot find module 'crypto' or its corresponding type declarations.
Solution:
To resolve this issue, I tried the following steps:

I set crypto to global.crypto, which worked fine in the browser and allowed the code to run without errors related to crypto.

ts
Copiar código
crypto = global.crypto;
Later, when I switched back to using require('crypto'), everything worked perfectly. This solution works well because, in a Node.js environment, require('crypto') functions as expected, but in the browser, global.crypto or alternative solutions like CryptoJS or Web Crypto API need to be used.

Summary:
By following this approach, I was able to resolve the error effectively: I first set crypto to global.crypto, and then used require('crypto') when I needed specific Node.js functionality. This allowed me to work with Angular 19 without any issues.

@cgrodriguezt cgrodriguezt changed the title hotfix: error crypto hotfix: error crypto with angular 19 Dec 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant