Skip to content
This repository has been archived by the owner on May 5, 2023. It is now read-only.

Browserify issue with vm.runInNewContext #5

Closed
RichardLitt opened this issue Feb 20, 2015 · 7 comments
Closed

Browserify issue with vm.runInNewContext #5

RichardLitt opened this issue Feb 20, 2015 · 7 comments

Comments

@RichardLitt
Copy link
Contributor

This line in index.js is breaking in my build:

var wg = vm.runInNewContext(regenerator('', { includeRuntime: true }) + ';wrapGenerator');

I've no idea why. I seem to be able to just comment it out and everything runs fine, so I'm not sure exactly what it is doing. The issue in the terminal is: Uncaught TypeError: Cannot set property 'wrapGenerator' of undefined. Any thoughts?

@TooTallNate
Copy link
Owner

You're really trying to run this in the browser? What's your use-case if you don't mind me asking?

@RichardLitt
Copy link
Contributor Author

I don't mind. It's one of the dependencies in mailgun-js. I'm not sure why they're using it; I want to use them with nodemailer to send emails from a Chrome extension.

@RichardLitt
Copy link
Contributor Author

vm-browserify ought to make this usable, and I think I'm using that already by just using browserify as it is. But I don't fully understand the scope of the problem. :/

@TooTallNate
Copy link
Owner

I think it's a vm-browserify bug actually. See browserify/vm-browserify#13.

With that patch applied, I was able to get browserified PacResolver working correctly (well, I wouldn't expect DNS or stuff like that to work, but at least the function compiled and executed with a dummy return value correctly).

@RichardLitt
Copy link
Contributor Author

Looks like you're right. Hopefully this gets pulled in pretty quick. Thanks!

@TooTallNate
Copy link
Owner

Also note that I had to use the "brfs" browserify transform (as a global transform, unfortunately), to make that fs.readFileSync() call be inlined: https://github.com/substack/brfs

@RichardLitt
Copy link
Contributor Author

Yep, I had been using that too. Thanks for mentioning it.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants