Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

Debugger ignores breakpoints for mjs modules #192

Closed
zaverden opened this issue May 20, 2018 · 3 comments
Closed

Debugger ignores breakpoints for mjs modules #192

zaverden opened this issue May 20, 2018 · 3 comments
Assignees

Comments

@zaverden
Copy link

zaverden commented May 20, 2018

Hello,

I have the same issue as #158 (despite of it is marked as solved)

Here is my index.mjs file:

const i = 5;
console.log("i: ", i);

I also have this script in my package.json:

  "scripts": {
    "debug": "node --experimental-modules --nolazy --inspect-brk=29229 index.mjs"
  }

And here is my launch.json configurations:

{
  "version": "0.2.0",
  "configurations": [
    {
      "type": "node",
      "request": "launch",
      "name": "Launch node",
      "program": "${workspaceFolder}/index.mjs",
      "runtimeArgs": [
        "--experimental-modules"
      ]
    }, {
      "type": "node",
      "request": "launch",
      "name": "Launch via NPM",
      "runtimeExecutable": "npm",
      "runtimeArgs": [
        "run-script",
        "debug"
      ],
      "port": 29229
    }
  ]
}

So, I have tried these 2 configurations, both run, show me i: 5 in console, but don't stop at breakpoints in the index.mjs. Am I missing some configuration attributes?

I'm using Windows 10 Pro
VS Code: v1.23.1
Node Debug: v1.23.5
Node JS: v9.11.1 and v10.1.0 (I have tried both)

@zaverden
Copy link
Author

I'm able to debug mjs in google chrome using NiM extension.

And I have found a way to do some debugging:
I have added new launch configuration

    {
      "type": "node",
      "request": "attach",
      "name": "Attach node",
      "port": 29229
    }

then I've started an app by npm debug (see debug script above), then hit F5 - and now I can go through my code step by step.
It works, but I can't say I can use it:

  • it is 2 separate steps to launch
  • it opens my files in separate tab as "read-only core module", and it does not saves break points

So, right now NiM is the best debugging solution. But I really like vscode and I'd like to debug my code without switching a context to browser.

P.S.
I have also tried to turn on "Auto Attach" - it ignores breakpoints too

@zaverden
Copy link
Author

I have found an issue #157 - a cause of my issue

@roblourens
Copy link
Member

Will continue tracking it in the other issue, thanks for the detailed report.

@vscodebot vscodebot bot locked and limited conversation to collaborators Jun 20, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants