replace crypto-js
See original GitHub issueWhen using oidc-client-ts
in an Angular application, the following warning is raised:
Warning: node_modules/oidc-client-ts/dist/esm/oidc-client-ts.js depends on ‘crypto-js/enc-base64.js’. CommonJS or AMD dependencies can cause optimization bailouts. For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies
There is a solution to explicitely make the warning silent in the application :
"architect": {
"build": {
"options": {
"allowedCommonJsDependencies": [
"crypto-js"
]
}
}
}
But I was thinking that, maybe, oidc-client-ts
could simply migrates to crypto-es. What do you think ?
Because unfortunately crypto-js
doesn’t seem to care about moving to es module… #60 and #236
Issue Analytics
- State:
- Created 2 years ago
- Reactions:2
- Comments:10 (4 by maintainers)
Top Results From Across the Web
Replacing CryptoJS with Web Cryptography | @qwtel
In this post I'll show how to replace CryptoJS' AES module with the Web Cryptography API for improved performance and security. With the...
Read more >Replace crypto-js by browser native WebCrypto ? #20 - GitHub
I agree it would be nice to use the webcrypto API - that would solve any potential adblocker misconfiguration and remove one more...
Read more >crypto-js - npm
JavaScript library of crypto standards.. Latest version: 4.1.1, last published: a year ago. Start using crypto-js in your project by running ...
Read more >How can I change following crypto code to use crypto-js
I wanted to use ViteJs. For the purpose, I need to use CryptoJS instead of Crypto. Current code using crypto is working fine....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I don’t like to argue popularity as the primary reason for choosing one over another, but in this case I do fear that crypto-es doesn’t have enough eyes on it, and ultimately this library won’t gain much from switching to it. We already use deep imports which provides most of the advantage that tree-shaking the ES modules port would provide.
Looking forward, we should be able to eventually use the Web Crypto APIs directly. There are projects like webcrypto-liner which might let us move off of crypto-js sooner while we wait for ubiquitous webcrypto support, but for now I think the safest option is to continue using crypto-js.
to what end?
it isn’t really a solution to move off npm to using CDNs for dependencies. and even if we did that somehow, the only CDNs that’d work are themselves running bundlers internally.
ultimately, crypto-js doesn’t work natively in browsers (it is a commonjs module). therefore, oidc-client-ts doesn’t work natively in browsers.
the only solutions really are to make crypto-js work in browsers (contribute upstream so they publish a browser entrypoint) or move off crypto-js to something which already works in browsers.
of course, bundlers can solve this by transforming commonjs dependencies into es modules. but we shouldn’t really put constraints on consumers’ workflows to be able to use this package.
its not a straight forward problem to solve though, i understand.