I am using pkg package for creating executable file for Windows and MacOS. I created simple script to show what is the problem:
const fs = require("fs");
if (!fs.existsSync("settings/config.json")) {
console.error("Could not find config.json file!");
} else {
console.log("Found! Works");
}
So basically it just has to check if settings/config.json file exists. When I run pkg test.js it compiles it for Windows and MacOS. On Windows when I run exe file everything works fine and I get Found! Works. When I run script by node test.js it also works fine but after I make executable from it and run it I get Could not find config.json file!. What can be a problem? Why MacOS cannot find same file after compiling it to executable file when it works by running node test.js? Is it about any folder structure or MacOS having anoter way of importing it or something?