如何解决使用 Parcel 和 Edge Chromium 对 VSCode 进行正确的调试配置
在启动 Parcel & Edge Chromium 时,标准启动配置选项似乎不起作用。
在 launch
模式下,浏览器会打开一个新的 Chromium 实例,该实例会丢失所有扩展设置,而 attach
模式只是拒绝加载浏览器,或导致此错误循环:
> parcel serve src/index.html
Debugger attached.
ℹ Server running at http://localhost:1234
@parcel/workers: Cannot find module '"c:/Users/jgent/AppData/Local/Programs/Microsoft'
Require stack:
- internal/preload
Error: Cannot find module '"c:/Users/name/AppData/Local/Programs/Microsoft'
Require stack:
- internal/preload
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:815:15)
at Function.Module._load (internal/modules/cjs/loader.js:667:27)
at Module.require (internal/modules/cjs/loader.js:887:19)
at Module._preloadModules (internal/modules/cjs/loader.js:1147:12)
at loadPreloadModules (internal/bootstrap/pre_execution.js:446:5)
at MessagePort.<anonymous> (internal/main/worker_thread.js:122:5)
at MessagePort.emit (events.js:314:20)
at MessagePort.onmessage (internal/worker/io.js:80:8)
at MessagePort.exports.emitMessage (internal/per_context/messageport.js:11:10)
这是我当前的配置:
launch.json:
{
"version": "0.2.0","configurations": [
{
"command": "npm start","name": "Parcel","request": "launch","type": "node-terminal"
},{
"type": "edge","version": "canary","name": "Debug","url": "http://localhost:1234","webroot": "${workspaceFolder}","breakOnLoad": true,"sourceMapPathOverrides": {
"../*": "${webroot}/*"
}
}
],"compounds": [
{
"name": "Parcel/Debug","configurations": ["Debug","Parcel"]
}
]
}
package.json:
{
"scripts": {
"start": "parcel serve src/index.html"
},}
有人有可用的配置吗?
解决方法
我终于能够使用此配置使其正常工作:
launch.json
{
"version": "0.2.0","configurations": [
{
"name": "Debug","type": "pwa-msedge","request": "launch","preLaunchTask": "Parcel","url": "http://localhost:1234","webRoot": "${workspaceFolder}"
}
]
}
tasks.json
{
"version": "2.0.0","tasks": [
{
"label": "Parcel","type": "npm","script": "start","isBackground": true,"problemMatcher": []
}
]
}
我还卸载并重新安装了 VSCode,也许这也有帮助。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。