- Version: "electron": "1.6.2", "electron-builder": "^16.8.2",
- Target: windows x64
I know I can add --js-flags="--max-old-space-size=4096" when run it using electron. But Where should I put this param to the build config of electron-builder?
I know I can add --js-flags="--max-old-space-size=4096" when run it using electron. But Where should I put this param to the build config of electron-builder?
Just wanted to add that, in my case, the max-old-space-size flag was only being successfully applied when I placed it in my webview's "preload" script, like so (Start_WebviewPreload.ts):
import {remote} from "electron";
remote.app.commandLine.appendSwitch("js-flags", "--max-old-space-size=8192");
Placing it in the "main.js" file (the entry point of the whole program), did not do anything. (I even checked the command-line arguments using Process Hacker 2 and it didn't show any of the electron processes as having that flag until I moved the code as mentioned above)
Also, I notice that there may be some kind of race condition between the setting of the command-line flag and the execution of app.on("ready") -- some of the time, the code above works for the main renderer process (the one not-in-the-webview), whereas other times it doesn't.
So basically: If you want to ensure your command-line switches work, apply them within the preload script for the given browser-window/web-view.