Search code examples
node.jsargumentsv8

Check nodejs V8 arguments


Is there an elegant way to detect the flags passed to the node runtime in code?

node --no-opt app.js

I'm trying to detect if the --no-opt option was passed in.

Unfortunately process.argv doesn't work and v8 doesn't seem to be giving any information either.


Solution

  • Apparently there is another field on process that we can check

    process.execArgv.includes('--no-opt')