I'm compiling a trivial Nim program using the JS backend and when using
"nim c -d:nodejs foo.nim" I get the following error:
Error: system module needs 'process.exit'.
If using "nim js -d:nodejs -d:release -o:foo.js foo.nim", the compilation succeeds, but when running the resulting JS in a browser, I get the following error on the dev console:
foo.js:278 Uncaught ReferenceError: process is not defined at foo.js:278
(line 278 in foo.js is "process.exitCode = 0;") Interestingly, if delete line 278, the script runs fine on the browser.
Any advice on what's the problem and how to avoid it? Thanks.
Thank you, that makes perfect sense.
It's working fine now.