Worker's initially loaded module should have == require.main #74

kriszyp opened this Issue Nov 19, 2009 · 1 comment


None yet
2 participants

kriszyp commented Nov 19, 2009

I think that the target module of a worker (the one indicated in the Worker constructor) should be able to detect that it is the initial module, presumably with ( == require.main). In worker.js I have tried setting workerGlobal.require.main = scriptName, but that does not seem to affect the require.main that is provided to the modules in the worker environment. I am not sure how one is supposed to set require.main.


kriskowal commented Nov 21, 2009

If you instantiate a Sandbox by calling SANDBOX.sandbox(id, system, options), the id module will be the main. If you instantiate a sandbox with the Sandbox constructor, you can call Sandbox(options).main(id) to start it with that module as the main.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment