Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion node_helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -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");

Expand Down