javascript - next.js 应用程序的 vscode 启动配置

标签 javascript visual-studio-code next.js

我正在使用 Visual Studio Code (vscode) 开发一个 next.js 应用程序,我非常喜欢这个编辑器!我已经从扩展商店安装了 Chrome 调试器。下面的配置启动了一个新的 Chrome 实例,我可以开始调试。它停在 vscode 的断点处,但问题来了。尽管我将其添加到“skipfiles”,但它不显示函数的值并跳转到 node_modules 事件。 断点也不会在构造函数上停止。 next.js 是否不被支持? 我经常使用 async wait 语法。调试服务器端代码运行良好。

    {
        "name": "My Client",
        "type": "chrome",
        "request": "launch",
        "url": "http://localhost:3000",
        "webRoot": "${workspaceRoot}/my-client/",
        "skipFiles": [
            "node_modules/**/*.js",
            "<node_internals>/**/*.js",
            "node_modules",
            ".next"
        ]
    }

最佳答案

以下内容对我有用(扩展自马克西米利亚诺·塞斯佩德斯的回答):

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [{
            "type": "node",
            "request": "launch",
            "name": "NPM Launch",
            "runtimeExecutable": "npm",
            "cwd": "${workspaceFolder}/my-app",
            "runtimeArgs": [
                "run-script",
                "debug"
            ],
            "port": 9229,
            "console": "integratedTerminal"
        },
        {
            "type": "node",
            "request": "attach",
            "name": "Attach",
            "port": 9229,
            "stopOnEntry": false,
            "restart": true
        },
        {
            "type": "chrome",
            "request": "launch",
            "name": "Chrome",
            "url": "http://localhost:4200",
            "webRoot": "${workspaceRoot}"
        }
    ],
    "compounds": [{
        "name": "Debug-Full",
        "configurations": ["NPM Launch", "Attach", "Chrome"]
    }]
}

关于javascript - next.js 应用程序的 vscode 启动配置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46018150/

相关文章:

javascript - 如何验证 ionic 单选按钮

html - 为什么 Prettier 代码格式化程序在 VS Code 中停止格式化?

visual-studio-code - Visual Studio 代码 ctrl + tab 无法正常工作

javascript - 将 unicode 转义添加到动态字符串值

javascript - 在函数中初始化的 typescript 继承属性被覆盖

javascript - JSON/jQuery 语法问题?

javascript - 如何使用 Javascript 添加时间到日期时间?

javascript - html5输入的焦点月份或年份[类型="date"]

ssh - Visual Studio Code Remote - SSH 连接失败

reactjs - React (Next.js) > 无效的 ARIA 属性 `ariaHidden` ,您的意思是 `aria-hidden` 吗?