launch.jsonargs
和in 有什么区别?runtimeArgs
// Optional arguments passed to the runtime executable
"runtimeArgs": []
// Command line arguments passed to the program
"args": []
程序与运行时可执行文件不是一回事吗?
问题背后的额外信息和动机:
我正在开发一个 nodejs 应用程序。在我的package.json
,我有一个start
脚本:
"start": "electron ./src/Main/main.js arg2"
,在我的应用程序代码中,我访问process.argv[2]
which get me arg2
,所以当我运行时npm start
,我的应用程序按预期工作。
当我从 VSCode 运行应用程序时,它没有,原因是我没有在launch.json
. 我应该把这些论点放在哪里?process.argv
似乎包含其中提供的论点,args
或者runtimeArgs
尽管它也包含一些--debug-brk
我不想要的论点。
process.argv
当我从命令行 ( npm start
) 运行应用程序或从 VSCode 启动它时,我希望能够始终如一地使用。