diff --git a/node_helper.js b/node_helper.js index 4f0b984..962bea4 100644 --- a/node_helper.js +++ b/node_helper.js @@ -331,7 +331,9 @@ module.exports = NodeHelper.create({ try { fs.accessSync(filename, fs.F_OK); // Add new line at the beginning of the file (this is necessary for modules which are bundled) - const newContent = `const Log = console;const document = navigator = window = {};document.createElement = function() { return {}; };\n${fs.readFileSync(filename, "utf8")}`; + let fileContent = fs.readFileSync(filename, "utf8"); + fileContent = `Module.register${fileContent.split("Module.register")[1].split(`}${fileContent.split("}")[fileContent.split("}").length - 1]}`)[0]}`; + const newContent = `const Log = console;const document = navigator = window = {};document.createElement = function() { return {}; };\n${fileContent}`; // Write the new content to the temporary file fs.writeFileSync(tempFilename, newContent, "utf8");