Node.js 如何在没有nodejs服务器的情况下在vscode中调试react应用程序
目前,我能够在vscode中调试react应用程序,这要感谢nodejs和扩展名“Chrome调试器”。这里是我的调试配置:Node.js 如何在没有nodejs服务器的情况下在vscode中调试react应用程序,node.js,reactjs,debugging,nginx,visual-studio-code,Node.js,Reactjs,Debugging,Nginx,Visual Studio Code,目前,我能够在vscode中调试react应用程序,这要感谢nodejs和扩展名“Chrome调试器”。这里是我的调试配置: { "name": "Attach to Chrome (desktop site by NodeJS)", "port": 9222, "request": "attach", "type&
{
"name": "Attach to Chrome (desktop site by NodeJS)",
"port": 9222,
"request": "attach",
"type": "chrome",
"webRoot": "${workspaceFolder}/desktop/src",
"url": "http://localhost:3000/",
},
{
"name": "Launch new Chrome (desktop site by NodeJS)",
"request": "launch",
"type": "chrome",
"webRoot": "${workspaceFolder}/desktop/src",
"url": "http://localhost:3000/",
},
{
"name": "Launch new Chrome (desktop site by Nginx)",
"request": "launch",
"type": "chrome",
"webRoot": "${workspaceFolder}/desktop/src",
"url": "https://mysite.local/",
},
从终端,我用npm start启动nodejs,它将在localhost:3000创建服务器
此外,如果我想避免创建新的Chrome窗口,我可以在远程调试中启动Chrome:
google-chrome --remote-debugging-port=9222
然后我可以浏览到localhost:3000,react文件中的vscode断点将停止线程。完美一切都像一个魅力
现在的疑问是,我是否可以在不使用nodejs和npmstart的情况下使用nginx服务器。
如果我尝试此配置:
{
"name": "Attach to Chrome (desktop site by NodeJS)",
"port": 9222,
"request": "attach",
"type": "chrome",
"webRoot": "${workspaceFolder}/desktop/src",
"url": "http://localhost:3000/",
},
{
"name": "Launch new Chrome (desktop site by NodeJS)",
"request": "launch",
"type": "chrome",
"webRoot": "${workspaceFolder}/desktop/src",
"url": "http://localhost:3000/",
},
{
"name": "Launch new Chrome (desktop site by Nginx)",
"request": "launch",
"type": "chrome",
"webRoot": "${workspaceFolder}/desktop/src",
"url": "https://mysite.local/",
},
我得到这个错误:
Could not read source map for https://mysite.local/static/js/2.937be170.chunk.js: Unexpected 404 response from...
我错过了什么