node debugging __DEV__ is not defined
See original GitHub issueI’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:
- Created 5 years ago
- Comments:9 (4 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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 thebuild
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 s
vscode
users out there that will benefit from handling this.Thoughts?
@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.