In production __dirname will resolve to the ASAR. To combat this, use app.getAppPath() if the app is packaged:
__dirname
app.getAppPath()
const { app } = require('electron'); const rootPath = app.isPackaged ? app.getAppPath() : __dirname;