-
-
Notifications
You must be signed in to change notification settings - Fork 34.2k
Closed
Labels
moduleIssues and PRs related to the module subsystem.Issues and PRs related to the module subsystem.questionIssues that look for answers.Issues that look for answers.v8 engineIssues and PRs related to the V8 dependency.Issues and PRs related to the V8 dependency.
Description
I don't understand the mistake here, so it could be just my dumbness.
If you execute the following code, it raises a ReferenceError (require is not defined).
Why is this the case and how to fix it?
The functionality of deserializing Functions on the fly is somehow required, as it's part of an update and debugging system. I am pretty sure this code / mechanics worked in a previous version of iojs.
I'm using v2.4.0. I could not find the code where it is injected, does anyone have hints where to look at?
bindargs = [ 'foo', 'bar' ];
bindargs.push('var fs = require("fs");');
var cb1 = Function.apply(Function, bindargs);
var cb2 = new Function(bindargs[0], bindargs[1], bindargs[2]);
console.log('Before CB2');
cb2();
console.log('After CB2');
console.log('Before CB1');
cb1();
console.log('After CB1');Metadata
Metadata
Assignees
Labels
moduleIssues and PRs related to the module subsystem.Issues and PRs related to the module subsystem.questionIssues that look for answers.Issues that look for answers.v8 engineIssues and PRs related to the V8 dependency.Issues and PRs related to the V8 dependency.