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

export an es module #105

Open
wighawag opened this issue Apr 9, 2021 · 2 comments
Open

export an es module #105

wighawag opened this issue Apr 9, 2021 · 2 comments

Comments

@wighawag
Copy link

wighawag commented Apr 9, 2021

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/aes-js@3.0.0/node_modules/aes-js/index.js:790:18
    at /@fs/C:/dev/wighawag/jolly-roger/node_modules/.pnpm/aes-js@3.0.0/node_modules/aes-js/index.js:798:3
    at instantiateModule (C:\dev\wighawag\jolly-roger\node_modules\.pnpm\vite@2.1.5\node_modules\vite\dist\node\chunks\dep-66eb515d.js:69030:166)

which indicate that this line fails root is undefined :

aes-js/index.js

Line 795 in 7c9fad4

if (root.aesjs) {

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 : master...wighawag:as-es-module

@t3db0t
Copy link

t3db0t commented Sep 3, 2021

I second this. I'm using this in a React project and had to manually redo the exports in order to import it.

@ricmoo
Copy link
Owner

ricmoo commented Sep 4, 2021

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.

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

No branches or pull requests

3 participants