question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

node debugging __DEV__ is not defined

See original GitHub issue

I’m trying to debug through VScode, but since __DEV__ is created by webpack, it’s undefined in debug mode so I’m getting this error.

Is there a way around it?

Should I attach the debugger to some localhost:SOME_PORT instead of the server source file?

I’m running the following: $ babel-node --inspect --inspect-brk ./src/server.js

And my launch.json inside .vscode is:

    {
      "type": "node",
      "request": "attach",
      "name": "Node Attach",
      "sourceMaps": true,
      "port": 9229,
      "protocol": "inspector"
    }

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
goldyluckscommented, May 21, 2018

Tried this with no luck: "start": "babel-node --inspect --inspect-brk tools/run start" I’m brand new to visual studio, so I’m not sure how to start approaching implementing/debugging this.

npm run start does write to the file system. If you delete the build folder, and make a change in the code, it gets regenerated.

The method you suggest might work if I set the breakpoints inside the compiled server code in build/server.js, which Is probably worse DX than just console log everything (i.e. not having the DX experience of vscode.

Since this starter kit is so popular, there must be many other svscode users out there that will benefit from handling this.

Thoughts?

0reactions
ulanicommented, May 27, 2021

@goldylucks thank you very much for crating this issue! Unfortunately, we have close it due to inactivity. Feel free to re-open it or join our Discord channel for discussion.

NOTE: The main branch has been updated with React Starter Kit v2, using JAM-style architecture.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Uncaught Exception: ReferenceError: debug is not defined
You just have to define the debug variable. let debug = true; if (debug) { mainWindow.webContents.openDevTools() mainWindow.maximize() ...
Read more >
How To Debug Node.js with the Built-In Debugger and ...
In this article, you will use a debugger to debug some sample Node. js applications. You will first debug code using the built-in...
Read more >
Debugging - Getting Started - Node.js
Debugging Guide. This guide will help you get started debugging your Node.js apps and scripts. ... ( SIGUSR1 is not available on Windows.)...
Read more >
Debug Node.js Apps using Visual Studio Code
Launch via npm: Launch a Node.js program through an npm 'debug' script. If you have defined an npm debug script in your package.json,...
Read more >
Making use of Node.js's Built-in Debugger
(Or as Node.js docs define: Open debugger's repl for evaluation in debugging ... OK since before reaching our breakpoint these variables are not...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found