aes-js
aes-js copied to clipboard
export an es module
aes-js is currently causing issue for es-module based system like https://vitejs.dev/
I am getting this error :
TypeError: Cannot read property 'aesjs' of undefined
at /@fs/C:/dev/wighawag/jolly-roger/node_modules/.pnpm/[email protected]/node_modules/aes-js/index.js:790:18
at /@fs/C:/dev/wighawag/jolly-roger/node_modules/.pnpm/[email protected]/node_modules/aes-js/index.js:798:3
at instantiateModule (C:\dev\wighawag\jolly-roger\node_modules\.pnpm\[email protected]\node_modules\vite\dist\node\chunks\dep-66eb515d.js:69030:166)
which indicate that this line fails root is undefined : https://github.com/ricmoo/aes-js/blob/7c9fad4add4b349dcb89a4e2125f37defaef3bc8/index.js#L795
Note that the error comes when importing @ethersproject/wallet that relies on aes-js
My current workaround is to use my fork of aes-js which expose es-module only via this minimal change : https://github.com/ricmoo/aes-js/compare/master...wighawag:as-es-module
I second this. I'm using this in a React project and had to manually redo the exports in order to import it.
I third this, as the author of aes-js and ethers. :)
This has been on my backlog for some time and I should be able to get to it this upcoming week. I want to update scrypt-js too.