Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

160
Views
javascript-obfuscator with pkg - require fails at runtime

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"
},

about 4 years ago · Santiago Gelvez
1 answers
Answer question

0

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')

about 4 years ago · Santiago Gelvez Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!