Open ddombrowsky opened 6 years ago
Seems to me like it's as easy as changing
require.main.require(mainModule);
to
return require.main.require(mainModule);
in init()
Also, for the sake of the internet, you can work around this by putting a pointer into the main module from within child.js
:
require.main.server = exports;
Then in the script which calls electronCompile.init()
, just use require.main.server
to pass in parameters to the compiled object.
I have a system that works perfectly with "compiled" javascript code, as done by electron-forge. It does exactly what I need.
Then I needed to fork a new process. This means I can't just point it to the javascript file that I want to run, because that's compiled and in the
.cache
directory. I can't just re-launches6-shim.js
, because that is hardcoded to launch the application inpackage.json
. I've resorted to copying in the raw js files, which kinda defeats the purpose of pre-compilingHow can I accomplish this? I've launching the child process with script:
but c is
undefined
and I can't use it as I would arequire
-d object. I can't figure out how to pass parameters into the newly minted process and call a js file that has been pre-compiled.Any ideas?