我使用 typescript 创建了一个普通的 React 应用程序
npx create-react-app test --template typescript
。
最新的 VSCode (1.87.2)、最新的 Chrome (123.0.6312.59)。 Windows 11。Firefox 是我的默认浏览器,但我的 launch.json 有意指定 Chrome(我更喜欢 Chrome 的调试工具):
{
// 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": "chrome",
"request": "launch",
"name": "Launch Chrome against localhost",
"url": "http://localhost:3000",
"webRoot": "${workspaceFolder}"
}
]
}
当我运行
npm start
时,Firefox 按预期启动该站点。如果我关闭 Firefox 页面并使用 VSCode 的 Run | Start Debugging
菜单选项,一切都会按预期工作。但是如果我使用 Run | Run Without Debugging
,chrome 就会出现,并带有正确的 url,但它会永远挂起,而不会访问我的任何代码。
这是新行为——不久前所有这些都运行良好。我不确定它什么时候改变,因为我不一直使用
Run Without Debugging
,但这是在过去几周内。
任何人都可以提供有关可能出现问题的线索和/或我如何追踪此问题吗?
已解决 - 这似乎是 vscode 中最新的 js 调试器中的错误。安装夜间扩展可以解决问题。 https://github.com/microsoft/vscode-js-debug#nightly-extension