Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/sql-server/27.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
开发模式下windows的electron builder软件包_Electron_Electron Builder - Fatal编程技术网

开发模式下windows的electron builder软件包

开发模式下windows的electron builder软件包,electron,electron-builder,Electron,Electron Builder,我需要在windows上测试我的应用程序,但我正在使用mac。打包应用程序以在windows上运行非常容易,但我无法在开发模式下打包应用程序。我正在使用electron is dev来决定是否在dev中运行。我需要在windows上运行测试,因为我正在测试非常特定的windows硬件功能。我不想仅仅为了运行这些测试而注释我的if(isDev){doSomething},然后在推动更改之前取消注释它。我希望可以在electron build cli中设置一些标志,或者运行eleton-window

我需要在windows上测试我的应用程序,但我正在使用mac。打包应用程序以在windows上运行非常容易,但我无法在开发模式下打包应用程序。我正在使用electron is dev来决定是否在dev中运行。我需要在windows上运行测试,因为我正在测试非常特定的windows硬件功能。我不想仅仅为了运行这些测试而注释我的
if(isDev){doSomething}
,然后在推动更改之前取消注释它。我希望可以在electron build cli中设置一些标志,或者运行
eleton-windows

通过将下面的示例代码添加到您的electron main.js来解析参数

const args = process.argv.slice(1);
windows = args.some(val => val === '-windows');

它仍然可以在electron可执行应用程序上解析,方法是在cmd中运行“electronapp.exe-windows”

通过将下面的示例代码添加到您的electron main.js中来解析参数

const args = process.argv.slice(1);
windows = args.some(val => val === '-windows');

它仍然可以在electron可执行应用程序上进行解析,方法是运行cmd,如“electronapp.exe-windows”

这样做的最好方法是使用IsDev,将electron_is_DEV环境变量添加到类似@carlokid的应用程序中。我用了:。这是我用于我的应用程序的目标:

C:\Windows\System32\cmd.exe /c "SET ELECTRON_IS_DEV=1 && START ^"^" ^"C:\Program Files (x86)\My App\Fun Time.exe^""

为了使用IsDev,最好的方法是将ELECTRON_is_DEV环境变量添加到应用程序中,就像@carlokid建议的那样。我用了:。这是我用于我的应用程序的目标:

C:\Windows\System32\cmd.exe /c "SET ELECTRON_IS_DEV=1 && START ^"^" ^"C:\Program Files (x86)\My App\Fun Time.exe^""