Skip to content Skip to sidebar Skip to footer

Excluding Config File While Converting Node Js Files To Exe Using Pkg

I'm developing a node.js application. To make the application unreadable for users, I'm trying to convert js files to exe. I'm using pkg to convert my files but got an issue. pkg m

Solution 1:

Finally found my mistake. I was requiring the config file in my javascript program which made pkg module to count config files as main program files and then packages them in the exe file. Instead I had to use read content of the file so the config file doesn't count in my program's files. Using fs.readFile() solved the issue.

Solution 2:

https://github.com/vercel/pkg/issues/195 use fs to read config file insead of require or import eg: const configPath = path.join(process.cwd(), './config/config.json'); lset data = fs.readFileSync(configPath);

Post a Comment for "Excluding Config File While Converting Node Js Files To Exe Using Pkg"