omniscientsquid --> Hi, I am trying to get a simple near login to work with my react app running html/js. Webtech such as react are very new to me so please excuse my ignorance. I am trying to provoke a near-api-js requestSignIn to work, but getting an error âUncaught (in promise) ReferenceError: Buffer is not definedâ
I dont know if this is a node/react issue or something I have done wrong with the js. I have ensured Buffer is installed with npm, and found some suggestion online that placing this in the main js file will fix it;
import * as buffer from âbufferâ;
(window as any).Buffer = buffer.Buffer;
However, âwindowâ isnât accessible through the react framework (or at least it doesnât seem to be). Does anyone have a suggestion as to where I am going wrong? The code is copied below.
omniscientsquid --> I think I have fixed it with adding âglobal.Buffer = global.Buffer || require(âbufferâ).Buffer; // eslint-disable-lineâ just under the imports. I have also noticed there is a stackoverflow link for questions, so will head over there next time.