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

How to run Iroh against large JS libraries? #13

Open
evanrolfe opened this issue Aug 21, 2019 · 1 comment
Open

How to run Iroh against large JS libraries? #13

evanrolfe opened this issue Aug 21, 2019 · 1 comment

Comments

@evanrolfe
Copy link

Hi, first of all this library is awesome, thanks for the contribution!

I would like to run Iroh against large js libraries like Jquery, React etc. however I am having trouble loading the entire library code into a string in order to pass it to Iroh.Stage(). For example, if you try and load the entire jquery 3.4.1 code into a string using like so:

const jqueryCode = `<JQUERY_CODE_GOES_HERE>`;
const stage = new Iroh.Stage(code);

Then it raises this error:

Uncaught SyntaxError: Octal escape sequences are not allowed in template strings.

I suppose I could do some find/replace operations on jquery.js and make the code able to be stored in a string but this is time consuming and I would like to be able to run Iroh against ANY javascript library. Do you have any ideas on how I can achieve this? Thanks, Evan.

@sns-sem
Copy link

sns-sem commented Oct 17, 2019

One way around this is by creating a file with the code in it and reading it, or using a request library and fetching it.

const { data: jquery } = await axios.get(JQUERY_CDN_URL);
const stage = new Iroh.Stage(jquery);

While I'm not doing this for jQuery, I am doing this for a large library and I get the same error as you doing it the "normal" way.

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