brix / crypto-js

JavaScript library of crypto standards.
Other
15.88k stars 2.39k forks source link

How to tree-shake CryptoJS.mode.CBC #367

Open johnmagbag1995 opened 3 years ago

johnmagbag1995 commented 3 years ago

I'm doing some bundle size optimization. My problem is how to import the CryptoJS.mode.CBC without importing the whole library.

`import CryptoJS from 'crypto-js'; import Utf8 from 'crypto-js/enc-utf8'; import { decrypt, encrypt } from 'crypto-js/aes';

const cipher = decrypt(encryptString, Utf8.parse(key), { iv: Utf8.parse(iv), mode: CryptoJS.mode.CBC, });`

likeswinds commented 3 years ago

image

entronad commented 1 year ago

Maybe you could try CryptoES,

It has same code with CryptoJS inside. It supports partially importing.