-
Notifications
You must be signed in to change notification settings - Fork 472
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
Fixing issue with polyfill #961
base: mainnet
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I figured out that most of the people speaking about this are operating in node.
Also, paraphrasing @onetrickwolf to provide context.
"I looked a little more into Issue 956. I thought this was a scoped export but I think since we are literally setting the globalThis.fetch it would replace anyone else's polyfill/fetch. I think the issue is, someone is importing the SDK into a nodejs
project where they are already using a fetch polyfill for some other reason, then this overwrites it maybe breaking other functionality.
I think we did this as a fix just to quick fix all instances of fetch in the SDK that would want to read from file in nodejs, but I think we would need to do what @zkxuerb is saying: give it a custom name then replace all instances of fetch in the SDK with a customFetch. I think it's probably better practice to do that anyway, but I also don't know if we had to do this due to something in the wasm or something that we wouldn't be able to rename?"
The polyfill breaks usage of the import { ViewKey } from '@aleohq/sdk';
import axios from 'axios';
console.log(!!ViewKey);
axios.get('https://jsonplaceholder.typicode.com/todos/1').then((resp) => {
console.log(resp.data);
}); output:
|
@anthonyjoeseph Thanks for bringing that to our attention, we're looking into it. |
@anthonyjoeseph I updated this PR to fix the issue with axios, thanks! |
Fixes #956