Before obfuscation executable file is successful but after javascript-obfuscation it gives me the below warning and it cannot output exe file.
Warning Cannot resolve '_0xe96414(443)'C:\Users\pathtofile.js
Dynamic require may fail at run time, because the requested file is unknown at compilation time and not included into executable. Use a string literal as an argument for 'require', or leave it as is and specify the resolved file name in 'scripts' option.
I went through this document here but I don't know how can I add all the requires into pkg scripts. Please let me know how to add requires into pkg scripts or any other way to add requires to pkg so it will include require in the executable.
const path = require("path");
const root = require("../../util/root/root");
const serveReactBundle = (req, res, next) => {
res.sendFile(path.join(root, "public", "build", "index.html"), err => { if (err) next(err) });
}
module.exports = serveReactBundle;
"pkg": {
"assets": [
"public/**/*",
"jsonfiles/**/*"
],
"targets": [
"node14-win-x64"
],
"private": "true",
"scripts": "modules/**/*.js"
},
The waring was informing that the url path is changed so I made the require path as the original file
path=require(_0x1fb780(0x154)),root=require(_0x1fb780(0x156))
As the warning told Dynamic require may fail at run time, because the requested file is unknown at compilation time and not included into executable, so in the obfuscated file I changed it to the normal path(below snippet) as in warning (or leave it as is) apparently it wont take the obfuscated path.
path=require('path'),root=require('../../util/root/root')