这是我的调试配置之一:
{
"version": "0.2.0",
"configurations": [
{
"type": "chrome",
"request": "attach",
"name": "Attach to Chrome",
"port": 9222,
"trace": true,
"webRoot": "${workspaceRoot}",
"sourceMapPathOverrides": {
"webpack:///./~/*": "${webRoot}/node_modules/*", // Example: "webpack:///./~/querystring/index.js" -> "/Users/me/project/node_modules/querystring/index.js"
"webpack:///src/*": "${webRoot}/src/*", // Example: "webpack:///src/App.js" -> "C:/project/src/App.js"
"webpack:///*": "${webRoot}/src/components/*" // Example: "webpack:///C:/project/hello.vue" -> "C:/project/src/hello.vue"
}
}
]
}
这是我对另一个低版本 vue 项目的调试配置:
{
// Use IntelliSense to learn about possible Node.js debug 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": "监听一个已经启动调试模式的Chrome",
"port": 9222,
"trace": true,
"webRoot": "${workspaceRoot}",
"sourceMapPathOverrides": {
"webpack:///./~/*": "${webRoot}/node_modules/*", // Example: "webpack:///./~/querystring/index.js" -> "/Users/me/project/node_modules/querystring/index.js"
"webpack:///node_modules/*": "${webRoot}/node_modules/*", // Example: "webpack:///node_modules/vux/src/components/toast/index.vue" -> "/Users/me/project/node_modules/vux/src/components/toast/index.vue"
"webpack:///src/*": "${webRoot}/src/*", // Example: "webpack:///src/App.js" -> "C:/project/src/App.js"
"webpack:///*": "*" // Example: "webpack:///C:/project/app.ts" -> "C:/project/app.ts"
}
}
]
}