金键盘
发布于 2025-09-03 / 3 阅读

vscode如何做到启动某个名字的launch。尤其nextjs这种多个配置的

没有发现直接启动调试某个名字的name,但是发现了可以通过debug.startFromDebug,注意args里面的值是launch.json里面的某个完整配置节

    {
        "key": "f1",
        "command": "debug.startFromConfig",
        "args": {
            "name": "CLIENT Next.js: debug client client-side 客户端",
            "type": "chrome",
            "request": "launch",
            "url": "http://localhost:3000/test",
            "webRoot": "${workspaceFolder}",
            "sourceMaps": true,
            "resolveSourceMapLocations": [
                "!**/node_modules/**",
                "!**/.next/**",
            ],
        }
    },

这个配置是在keybindings.json里面配置f1直接启动launch.json的某个配置的副本。不是通过launch.json里面的name来启动的。


评论