Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to debug this project? #175

Open
Altiano opened this issue Jun 1, 2020 · 3 comments
Open

How to debug this project? #175

Altiano opened this issue Jun 1, 2020 · 3 comments

Comments

@Altiano
Copy link

Altiano commented Jun 1, 2020

How do you perform debugging with backpack ?
I'm using VS Code.

For Node.js program, by default the config would be like:

        {
            "type": "node",
            "request": "launch",
            "name": "Launch Program",
            "skipFiles": [
                "<node_internals>/**"
            ],
            "program": "${workspaceFolder}/build/main.js"
        }

How to adjust this?
And maybe should also put this in the docs?

@waynelinks
Copy link

I'm struggling with the same thing

How do you setup debugging @jaredpalmer

@waynelinks
Copy link

@Altiano I've opted to use babel-node to debug. It's working with Backpack.

Install the following plugins:

yarn add -D @babel/core @babel/node @babel/preset-env

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": "node",
      "request": "launch",
      "name": "babel-nodemon",
      "program": "${workspaceFolder}/src/index.js",
      "skipFiles": [
        "<node_internals>/**"
      ],
      "restart": true, // <= important!
      "runtimeExecutable": "${workspaceFolder}/node_modules/.bin/nodemon", // <= local path if nodemon not installed globally
      "args": ["--exec", "${workspaceFolder}/node_modules/.bin/babel-node" ],
      "sourceMaps": true,
      "env": {
        "BABEL_ENV": "debug",
        
      },
      "envFile": "${workspaceFolder}/src/config/dev.env"
    }
  ]
}

.babelrc

{
  "presets": [
    "backpack-core/babel",
    "@babel/preset-env"
  ],
  "env": {
    "debug": {
      "sourceMaps": "inline",
      "retainLines": true
    }
  }
}

Hope this helps.

@meotimdihia
Copy link

meotimdihia commented Aug 11, 2021

2 simple ways in .vscode/lautch.json

//1
    {
      "name": "Launch via NPM",
      "request": "launch",
      "runtimeArgs": [
        "dev",
      ],
      "runtimeExecutable": "yarn",
      "skipFiles": [
        "<node_internals>/**"
      ],
      
      "type": "pwa-node"
    },
//2
    {
      "command": "npm dev",
      "name": "Run npm dev",
      "request": "launch",
      "type": "node-terminal"
    }

launch-snippets 1

reference https://code.visualstudio.com/docs/nodejs/nodejs-debugging

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants