首页 > 解决方案 > 电子没有得到命令行参数

问题描述

尝试在 Electron.js 中为 localhost dev 创建一个选项(我有两种类型的 config.inis 用于本地和非本地选项)并且想从命令行运行命令,例如 yarn dev --scope=local

但是,我无法让 process.argv 工作,argv 数组仅显示:

['C:\xxxx\xxxxxx\xxxxxx\xxxxxx\node_modules\electron\dist\electron.exe', '-r', './internals/scripts/BabelRegister', './app/main.dev.ts' ]

这里它说获取 argv 取决于进程类型,但我的是主要的。将命令行参数传递给电子可执行文件(安装已打包的应用程序后)

非常感谢帮助!

标签: electron

解决方案


推荐阅读