问题
I have used AWS's JS Builder (https://sdk.amazonaws.com/builder/js/) to generate a minified build of only their Lambda SDK. Now I want o use that in a NodeJS-like (specifically ReactJS) environment.
Currently, I am doing so (after referring https://stackoverflow.com/a/49218103/1847976) by adding the said script in the /public/index.html
and then accessing the main export (here: AWS
) via the window
object (as in here window.AWS
).
However, are there any issues (specifically compatibility issues) I may face with such a workaround? If yes, is there a way I can directly use the minified JS obtained from AWS's JS Builder in ReactJS? Or is there a totally different method I could I have followed?
P.S.: I have already tried using the in-preview AWS SDK (https://github.com/aws/aws-sdk-js-v3) which will be modularised but faced un-fixable problems (due to which I posted another question here: AWS JS SDK V3 (Lambda module) - Unable to connect to instance metadata service), therefore that is ruled out. I also tried plainly adding the minifed (and unminified) file directly in my React project and importing it but that didn't work either
来源:https://stackoverflow.com/questions/56476748/js-use-files-meant-for-script-in-node