1. 程式人生 > 實用技巧 >18 vs code 除錯 vue

18 vs code 除錯 vue

1: chrome-> 右鍵-> 屬性,加上--remote-debugging-port=9222

2: VS code 安裝”Debugger for Chrome“

3: 左側 除錯, Attach to chrome, 在launch,json中輸入如下配置: 注意標註紅色的是你專案的實際地址,配置正確的埠號。

{
  // 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": "attach", "name": "Attach to Chrome", "port": 9222, "webRoot": "${workspaceRoot}/src", "url": "http://localhost:8002/#/",  "sourceMaps": true,
"sourceMapPathOverrides": { "webpack:///src/*": "${webRoot}/*" } } ] }

4: 在config/index.js中的dev下面填加如下兩項內容:

 devtool: 'eval-source-map',
    cacheBusting: false,

5:開啟chrome, 然後NPM run dev啟動你的專案, 然後點選如下的綠色三角號