执行参数扩展
【Execution argument extension】
execArgvExtension 字段控制如何提供除 execArgv 字段中指定的之外的额外执行参数。它接受以下三个字符串值之一:
【The execArgvExtension field controls how additional execution arguments can be
provided beyond those specified in the execArgv field. It accepts one of three string values:】
"none":不允许使用扩展。只会使用execArgv中指定的参数,并且NODE_OPTIONS环境变量将被忽略。"env":(默认)NODE_OPTIONS环境变量可以扩展执行参数。这是为了保持向后兼容性的默认行为。cli:可执行文件可以使用--node-options="--flag1 --flag2"启动,这些标志将被解析为 Node.js 的执行参数,而不是传递给用户脚本。这允许使用NODE_OPTIONS环境变量不支持的参数。
例如,使用 "execArgvExtension": "cli" 时:
【For example, with "execArgvExtension": "cli":】
{
"main": "/path/to/bundled/script.js",
"output": "/path/to/write/the/generated/blob.blob",
"execArgv": ["--no-warnings"],
"execArgvExtension": "cli"
} 可执行文件可以这样启动:
【The executable can be launched as:】
./my-sea --node-options="--trace-exit" user-arg1 user-arg2 这相当于运行:
【This would be equivalent to running:】
node --no-warnings --trace-exit /path/to/bundled/script.js user-arg1 user-arg2