1

启动 Parcel & Edge Chromium 时,标准启动配置选项似乎不起作用。

使用launchmode 时,浏览器会打开一个新的 Chromium 实例,该实例会丢失所有扩展设置,而attachmode 只是拒绝加载浏览器,或者导致以下错误循环:

> 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)

这是我当前的配置:

启动.json:

{
  "version": "0.2.0",
  "configurations": [
    {
      "command": "npm start",
      "name": "Parcel",
      "request": "launch",
      "type": "node-terminal"
    },
    {
      "type": "edge",
      "request": "launch",
      "version": "canary",
      "name": "Debug",
      "url": "http://localhost:1234",
      "webRoot": "${workspaceFolder}",
      "breakOnLoad": true,
      "sourceMapPathOverrides": {
        "../*": "${webRoot}/*"
      }
    }
  ],
  "compounds": [
    {
      "name": "Parcel/Debug",
      "configurations": ["Debug", "Parcel"]
    }
  ]
}

包.json:

{
"scripts": {
    "start": "parcel serve src/index.html"
  },
}

有人有工作配置吗?

4

1 回答 1

0

I was finally able to get this working with this configuration:

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": []
    }
  ]
}

I also uninstalled and reinstalled VSCode, perhaps that helped as well.

于 2021-03-16T22:53:30.527 回答