mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-04-28 11:41:04 +00:00
Add dev launch config and preserve existing NODE_OPTIONS
Add a "Dev Launch CLI" VS Code debug configuration and fix scripts/dev.js to preserve existing NODE_OPTIONS (e.g. --inspect flags injected by VS Code debugger) instead of overwriting them.
This commit is contained in:
parent
66f754e203
commit
3c513b6271
2 changed files with 18 additions and 2 deletions
13
.vscode/launch.json
vendored
13
.vscode/launch.json
vendored
|
|
@ -127,6 +127,19 @@
|
||||||
"cwd": "${workspaceFolder}",
|
"cwd": "${workspaceFolder}",
|
||||||
"console": "integratedTerminal",
|
"console": "integratedTerminal",
|
||||||
"env": {}
|
"env": {}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "node",
|
||||||
|
"request": "launch",
|
||||||
|
"name": "Dev Launch CLI",
|
||||||
|
"runtimeExecutable": "npm",
|
||||||
|
"runtimeArgs": ["run", "dev"],
|
||||||
|
"skipFiles": ["<node_internals>/**"],
|
||||||
|
"cwd": "${workspaceFolder}",
|
||||||
|
"console": "integratedTerminal",
|
||||||
|
"env": {
|
||||||
|
"GEMINI_SANDBOX": "false"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"inputs": [
|
"inputs": [
|
||||||
|
|
|
||||||
|
|
@ -67,13 +67,16 @@ register('${loaderUrl}', pathToFileURL('./'));
|
||||||
`;
|
`;
|
||||||
writeFileSync(registerPath, registerCode);
|
writeFileSync(registerPath, registerCode);
|
||||||
|
|
||||||
|
// Preserve existing NODE_OPTIONS (e.g. VS Code debugger injects --inspect flags via NODE_OPTIONS)
|
||||||
|
const existingNodeOptions = process.env.NODE_OPTIONS || '';
|
||||||
|
const importFlag = `--import ${pathToFileURL(registerPath).href}`;
|
||||||
|
|
||||||
const env = {
|
const env = {
|
||||||
...process.env,
|
...process.env,
|
||||||
DEV: 'true',
|
DEV: 'true',
|
||||||
CLI_VERSION: 'dev',
|
CLI_VERSION: 'dev',
|
||||||
NODE_ENV: 'development',
|
NODE_ENV: 'development',
|
||||||
// Use --import with register() instead of deprecated --loader
|
NODE_OPTIONS: `${existingNodeOptions} ${importFlag}`.trim(),
|
||||||
NODE_OPTIONS: `--import ${pathToFileURL(registerPath).href}`,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const nodeArgs = [tsxPath, cliEntry, ...process.argv.slice(2)];
|
const nodeArgs = [tsxPath, cliEntry, ...process.argv.slice(2)];
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue