saltyshiomix/nextron

Command line arguments not working in dev command

mbakker96 opened this issue · 1 comments

Hi,

we have a problem with implementing command line arguments in dev mode. Everything works like expected when running the app after a build

Implementation
We have an electron app, that can be configured with some app arguments (config, no-service). When you start app the app after compilation, it is like ./app.exe --config="xx/xx/xx.json". That works perfectly, but we also want to pass through this argument when running nextron dev. Like nextron dev --config="xx/xx/xxjson" or as we expected when reading the documentation nextron dev --electron-options="--config=\"test123\". Our expectation should then that app.commandLine.getSwitchValue("config") returns in test123

Currently the above functions responses with '"test123" --remote-debugging-port=5858 --inspect=9292' and I don't this should be the output. Can you take a look at this to see if we are doing something wrong of this is a bug in the app.

Found the source of the problem at the hander of for the --electron-options param. Problem is that the arguments are given in de execa command at lib/nextron-dev.ts:71 as a whole string, so like one whole argument.

Electron has a problem with resolving this implementation, if I for example run the electron command directly in my terminal then it works like a charm.

We should split the arguments and join them to the argument param, instead of one large string. I found a stackoverflow article about splitting these commands:

https://stackoverflow.com/questions/13796594/how-to-split-string-into-arguments-and-options-in-javascript