for posterity: I FIGURED IT OUT (ish)
For some reason, ejs.renderFile()
needs an absolute path when the app is built with electron-builder
.
So, you need to do like this:
${path.join(__dirname,
./${consequence}.ejs)}
ejs.renderFile(`${path.join(__dirname, `views/list.ejs`)}`, { data: listData }, { root: __dirname },
function (err, str) {
if (err) {
console.log(err);
}
mainWindow.loadURL('data:text/html;charset=utf-8,' + encodeURI(str));
}
);
As to WHY this is the case, I do not know (since __dirname is included as “root” option param…I’m guessing there is a bug.
CLICK HERE to find out more related problems solutions.