Skip to content

[Question] How to launch a debugger #558

Closed
@brandonkal

Description

@brandonkal

How does one launch a debugger when using Yarn PNP.
Part of the issue may be:

  • VSCode does not yet support navigating to files in zip files. So I imagine this means unplugging all the packages.

However, I am having trouble understanding how to start a debugger with a pnp project. As node doesn't have support for yarn pnp, this did not work:

.vscode/launch.json

{
  "version": "0.2.0",
  "configurations": [
    {
      "type": "node",
      "request": "launch",
      "runtimeExecutable": "yarn",
      "name": "dev server",
      "cwd": "${workspaceFolder}",
      "runtimeArgs": ["start:debug"],
      "port": 5858
    }
  ]
}

package.json

{
  "name": "hot-typescript",
  "version": "1.0.0",
  "license": "MIT",
  "scripts": {
    "start": "webpack-dev-server --hot",
    "start:debug": "node --inspect-brk=5858 ./node_modules/.bin/webpack-dev-server --hot"
  },
  "devDependencies": {
    "@babel/core": "^7.6.0",
    "@babel/plugin-proposal-class-properties": "^7.5.5",
    "@babel/plugin-proposal-decorators": "^7.6.0",
    "@babel/preset-env": "^7.6.3",
    "@babel/preset-react": "^7.6.3",
    "@babel/preset-typescript": "^7.6.0",
    "@types/node": "^12.12.0",
    "@types/react": "^16.9.11",
    "@types/react-dom": "^16.9.3",
    "@types/webpack": "^4.39.5",
    "autoprefixer": "^9.7.0",
    "babel-loader": "^8.0.6",
    "babel-plugin-macros": "^2.6.1",
    "css-loader": "^3.2.0",
    "fork-ts-checker-webpack-plugin": "^1.5.0",
    "html-webpack-plugin": "^3.2.0",
    "mini-css-extract-plugin": "^0.8.0",
    "pnp-webpack-plugin": "^1.5.0",
    "postcss-loader": "^3.0.0",
    "postcss-nested": "^4.1.2",
    "ts-node": "^8.4.1",
    "typescript": "^3.6.3",
    "webpack": "^4.40.2",
    "webpack-cli": "^3.3.8",
    "webpack-dev-server": "^3.8.1"
  },
  "dependencies": {
    "@brandonkal/linaria": "^3.0.0-beta.8",
    "@hot-loader/react-dom": "^16.10.2",
    "@yarnpkg/pnpify": "^2.0.0-rc.7",
    "core-js": "^3.2.1",
    "react": "^16.9.0",
    "react-dom": "^16.9.0",
    "react-hot-loader": "^4.12.13",
    "regenerator-runtime": "^0.13.3"
  }
}

I didn't expect the above to work, as node doesn't understand yarn pnp, but that is where the test project is now.

Perhaps this hasn't yet been implemented, but I would like to debug my package to get it working in Yarn PNP.

Metadata

Metadata

Assignees

No one assigned

    Labels

    external bugThis issue highlights a bug in another project

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions