-
Notifications
You must be signed in to change notification settings - Fork 16.7k
Closed
Description
- Electron version: 1.4.11
- Operating system: macOS 10.12.2
Expected behavior
I expected Electron to wrap JS modules in the same function wrapper as Node's. Electron defines an extra parameter ("process") which breaks code like const process = .... See Node's wrapper:
'(function (exports, require, module, __filename, __dirname) { 'I tested with Node 6.0.0 & Node 7.4.0 and both use this wrapper.
Actual behavior
Electron uses a slightly different wrapper from its vendored copy of Node:
'(function (exports, require, module, __filename, __dirname, process, global) { 'How to reproduce
In a file loaded by Electron I have:
const child_process = require('child_process');
child_process.fork('./sample.js', [], {
env: {
...process.env,
ELECTRON_RUN_AS_NODE: 1,
},
silent: true,
});and sample.js is:
'use strict';
const process = require('process');and this results in the error: SyntaxError: Identifier 'process' has already been declared
Metadata
Metadata
Assignees
Labels
No labels