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

use global instead of window #7

Open
fibo opened this issue Jun 14, 2023 · 3 comments
Open

use global instead of window #7

fibo opened this issue Jun 14, 2023 · 3 comments

Comments

@fibo
Copy link

fibo commented Jun 14, 2023

Hi,

strnum package is a dependency of fast-xml-parser which is a dependency of @aws-sdk/client-s3.

When I try to bundle with esbuild an AWS lambda that reads/write to S3 I get an error caused by window.parseInt (used in strnum implementation).

Could it be possible to use globalThis.parseInt ?

@amitguptagwl
Copy link
Member

Ideally this problem may come only if Number.parseInt is not present and you're not using the library in browser. To handle both, I may try to remove both. Let me try

@amitguptagwl
Copy link
Member

Though I have fixed it on my local, can you please check whether your node js version supports parseInt and Number.parseInt?

@fibo
Copy link
Author

fibo commented Jun 19, 2023

Yes, for example Node v16 supports both parseInt and Number.parseInt.

If possible, please remove window or use globalThis or whatever you think it is worth to support isomorphic JS.

Thanks

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

2 participants