in src/commands/dev/server.ts [21:55]
start() {
if (this.instance) {
return;
}
const root = getRoot();
const inspectPort = getDevConf('inspectPort', 'dev', 9229);
// @ts-ignore
const id = global.id || '';
let inspectOption = '--inspect';
if (inspectPort !== 9229) {
inspectOption = `--inspect=127.0.0.1:${inspectPort}`;
}
this.instance = spawn(
this.command,
[
'run',
'--no-lock',
'--allow-net',
'--allow-read',
'--allow-write',
inspectOption,
path.join(root, `.dev/index-${id}.js`),
id
],
{
stdio: ['pipe', 'pipe', 'pipe']
}
);
this.instance.stdout?.setEncoding('utf8');
this.instance.stdout?.on('data', this.stdoutHandler.bind(this));
this.instance.stderr?.on('data', this.stderrHandler.bind(this));
this.instance.on('close', this.closeHandler.bind(this));
this.instance.on('error', this.errorHandler.bind(this));
}