2

Enterprise where I work has developed an internal app using react.js and typescript also developed some node modules and now is my turn to work with it and I figure out an issue that bring me to this question.

How can I debug with VSC a node module from my app? I have access to both source codes. My directories structure.

Documents
|-- my-app
    |--src
       |--App.tsx #File that import @enterprise/my-node-module and use someFunction that I want to debug
|-- my-node-module
    |--src
       |--Action.ts #File with someFunction that I want to debug
|-- another-node-module #Another node module

Also I have configured VSC to debug my app and works perfect.

{
  "version": "0.2.0",
  "configurations": [{
      "type": "chrome",
      "request": "attach",
      "port": 9222,
      "name": "Attach Chrome against localhost",
      "url": "http://localhost:3000",
      "webRoot": "${workspaceFolder}"
    },
    {
      "name": "Chrome",
      "type": "chrome",
      "request": "launch",
      "url": "http://localhost:3000",
      "webRoot": "${workspaceFolder}/src",
      "sourceMapPathOverrides": {
        "webpack:///src/*": "${webRoot}/*"
      },
      "runtimeArgs": ["--preserve-symlinks"]
    }
  ]
}

Package.json script from my app

"scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build"
  },

As you can notice I tried to debug using this but nothing. The main reason for this is that I don't know how to debug module directly and has been builded to work as a middleware with redux-thunk.

Hope somebody can help me.

Alan Aranda
  • 202
  • 3
  • 14

0 Answers0