chrome調試時只能在打開的瀏覽器里進行調試,其它打開的chrome瀏覽器就不能調試了,怎么解決。
右鍵點擊 Chrome 的快捷方式圖標,選擇屬性 在目標一欄,最后加上--remote-debugging-port=9222 注意要用空格隔開
lanch.json 文件配置
{"version": "0.2.0","configurations": [{"name": "Attach to Chrome","port": 9222,"request": "attach","type": "chrome","url": "http://localhost:8056/add-system/","webRoot": "${workspaceFolder}","sourceMapPathOverrides": {"webpack:///src/*.vue": "${workspaceFolder}/src/*.vue","webpack:///./src/*.js": "${workspaceFolder}/src/*.js"},}]
}
打開瀏覽器,當前端頁面進入?http://localhost:8056/add-system/?后就會自動走入斷點。如果多個瀏覽器都想走入調試可以設置多個配置,然后設置同時啟動。
啟動兩個調試方法
{"version": "0.2.0","configurations": [{"name": "Attach","port": 9222,"request": "attach","type": "chrome","url": "http://localhost:8056/add-system/","webRoot": "${workspaceFolder}","sourceMapPathOverrides": {"webpack:///src/*.vue": "${workspaceFolder}/src/*.vue","webpack:///./src/*.js": "${workspaceFolder}/src/*.js"}},{"type": "chrome","request": "launch","name": "Chrome","url": "http://localhost:8056/add-system/","webRoot": "${workspaceFolder}","sourceMapPathOverrides": {"webpack:///src/*.vue": "${workspaceFolder}/src/*.vue","webpack:///./src/*.js": "${workspaceFolder}/src/*.js"}}],"compounds": [{"name": "啟動所有","configurations": ["Chrome","Attach"],"stopAll": true}]
}