I am developing an electron app with react and I have a python file which I want to run through main process of electron.
I am using child-process of node js to spawn the python exe(esic.exe) file. I created the python exe file using pyinstaller which runs fine in standalone mode.
const exeLocation = path.join(__dirname, 'dist/esic.exe')
const process = spawn(exeLocation, [args])
In development mode everything runs properly, main process of electron could able to spawn the process and send arguments and receive the output, but once I package the electron app using electron-builder it gives me this ENOENT code error

I searched about ENOENT error and found that it's the error which indicates that the specified path for a file or directory does not exist in the filesystem so I tried to unpackage the electron build which has a app.asar file. On unpackaging the asar file I found that it contains the dist directory and there is a esic.exe file in it, so that means the electron-builder packaged the build correctly.
Now I am totally confused about why it runs in development mode but not in production mode.