I found a way to get this working and I thought I'd record it here for the benefit of others.
I had to patch the plugin with a hack, which can certainly be made more graceful (which I will attempt to achieve and submit a PR).
In nativeScriptCli.ts, I modified the following methods to add the NODE_OPTIONS environment variable to each spawn of Node:
public executeSync(args: string[], cwd: string): string {
args.unshift('--analyticsClient', 'VSCode');
const command: string = `${this._path} ${args.join(' ')}`;
let env = process.env;
env["NODE_OPTIONS"] = "--max-old-space-size=4096";
this._logger.log(`[NativeScriptCli] execute: ${command}`);
return execSync(command, { encoding: 'utf8', cwd, shell: this._shellPath, env: env }).toString().trim();
}
public execute(args: string[], cwd: string): ChildProcess {
args.unshift('--analyticsClient', 'VSCode');
const command: string = `${this._path} ${args.join(' ')}`;
this._logger.log(`[NativeScriptCli] execute: ${command}`);
let env = process.env;
env["NODE_OPTIONS"] = "--max-old-space-size=4096";
const options = { cwd, shell: this._shellPath, env: env };
const child: ChildProcess = spawn(this._path, args, options);
child.stdout.setEncoding('utf8');
child.stderr.setEncoding('utf8');
return child;
}
After installing this hacked version on my Mac, the app now successfully builds in VS Code.