Skip to content
This repository has been archived by the owner on Oct 8, 2024. It is now read-only.

Play nice with v8's inspector #3

Closed
cirocosta opened this issue Feb 11, 2017 · 5 comments
Closed

Play nice with v8's inspector #3

cirocosta opened this issue Feb 11, 2017 · 5 comments

Comments

@cirocosta
Copy link
Contributor

cirocosta commented Feb 11, 2017

Hey,

i find very useful to use node's debugger (either through chrome's integration or the "gdb-style" node debugger directly), however, i can't get it working with magnet start, maybe because of how it reload files .. no idea hmmm

I suppose this is not a priority but it helps a lot to debug & profile applications.

Perhaps we can get it running if we disable hot reloading? Wdyt?

Thx! 💃


Reproducing is straightforward:

npm i express
echo "
var express = require('express')
var app = express()

app.get('/', function (req, res) {
  debugger;
  res.send('Hello World!')
})

app.listen(3000, function () {
  console.log('Example app listening on port 3000!')
})" > index.js

node debug index.js
> cont

then curl localhost:3000/ and see that it will stop at the debugger line:

screen shot 2017-02-11 at 11 14 16

Also true for --inspect:

screen shot 2017-02-11 at 11 10 18

However, having a directory with magnet installed and a file authorize.js which has simply

module.exports = (app) => {
  app.get("/v1", (req, res) => {
    debugger;
    res.send("yay");
  });

  return this;
};

does not trigger the breakpoint on debugger.

@pragmaticivan
Copy link
Contributor

Thanks, I have plans to add that into the CLI.
ex:

magnet start --debug

@pragmaticivan
Copy link
Contributor

Heads up: @cirocosta
You can use: node --inspect ./node_modules/.bin/magnet dev for now.

@pragmaticivan
Copy link
Contributor

FYI: nodejs/node#11275

--debug will be deprecated.

@cirocosta
Copy link
Contributor Author

ooooooh rly? :( but --inspect still fine, right?

@pragmaticivan
Copy link
Contributor

Yes

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

No branches or pull requests

3 participants