如何增加电子构建器构建的应用程序的最大内存限制? [英] How to increase the max memory limit for the app built by electron-builder?

查看:97
本文介绍了如何增加电子构建器构建的应用程序的最大内存限制?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  • 版本:电子":"1.6.2",电子生成器":"^ 16.8.2",
  • 目标:Windows x64
  • Version: "electron": "1.6.2", "electron-builder": "^16.8.2",
  • Target: windows x64

我知道我可以在使用电子运行时添加-js-flags =-max-old-space-size = 4096" .但是我应该把这个参数放在电子生成器的构建配置中吗?

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?

推荐答案

在main.js中,添加:

In main.js, add:

app.commandLine.appendSwitch('js-flags', '--max-old-space-size=4096');

根据受支持的Chrome命令行切换,应在发出 ready 事件之前调用它.例如:

According to Supported Chrome Command Line Switches, this should be called before the ready event is emitted. For example:

import { app } from "electron";

app.commandLine.appendSwitch('js-flags', '--max-old-space-size=4096');

app.on('ready', () => {
    // ...
});

这篇关于如何增加电子构建器构建的应用程序的最大内存限制?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆