Skip to content

export an es module #105

@wighawag

Description

@wighawag

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 :

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions