Open Stalso opened 8 years ago
Have you tried using the gulp serve:debug
task, which runs node-inspector
? I know you said "Debugging in WebTools is awfull", but node-inspector
uses the same interface as the Chrome dev tools to debug your server-side code
Yes, I have tried. And I do no not like them. Restart of the server is really slow. Debugging is inconvenient and not visual. Switching between three tabs (editor, browser with client and webtools) is annoying. I have only two monitors 😊
It is really frustrating for me too, having a project which you cannot debug..
should "grunt serve:debug" also run the debugger? I think i have tried that but did not really work... in terminal appears at the end sth like "open localhost:8080/debug?port=5858 to debug".. but nothing is really running there..
@akcasoy grunt serve:debug
&& gulp serve:debug
both use node-inspector, an environment-agnostic server debugging tool that uses the Chrome dev tools to debug your server. You can open the URL it tells you to to use the chrome debug tools on your server.
The generator isn't set up to support built-in WebStorm debugging out-of-the-box, but I'd be happy to have people help investigate how to get everything set up, and make a docs section about it.
@Awk34 , everything I wrote in start post is working. Feel free to use, if nobody have better solution.
@Stalso while it works for you, I feel like there's a simpler solution. I use WebStorm personally, so I'll try to investigate when I get some time.
It will be cool. The reason, why I have created the isuue is to ind a better way to establish debugging
Hello. I am .Net developer and new in NodeJs. The first point to start learning this - your template. And the first thing I wanted to have - debugging code in some IDE, because I am used to IDE (Visual studio). Debugging in WebTools is awfull. Your server code is written using ES6 and Babel. And I have invested some time to make it debuggable in IDE. I have chosen Webstorm (last version) for it.
I have generated project with such options
Neither WebStrom nor VisualStudio Code cannot debug ES6. That's why I need to transpile server in ES5 during development. I did it in
.tmpsrv
folder. For that reason I have added new variable topaths
object ingulpfile.babel.js
:Also I have created some gulp tasks and added them in
gulpfile.babel.js
:Now, if I fire
gulp:serve:ide
task, .tmp
folder with transpiled client and.tmpsrv
folder with transpiled server and source maps wiil be created (but you SHOULD NOT do it right now).index.js
of the server in this folder will be startup file for debugging session in WebStrom ( this IDE can debug ES6 with source maps, if we start debugging session for ES5 code and put breakpoints in ES6 code). As you see I will start my server from.tmpsrv
folder during debugging, that is why I need to modify some paths and settings in projects.First of all I go to
server/config/environment/index.js
and add such code inall
object:Than I add file 'developmentIde.js' in
server/config/express.js' folder and copy contents of
server/config/environment/development.js' there.Then I go to `server/config/express.js' and replace this:
with this:
Also I replace this:
with this:
Also I replace this:
with this:
Also I replace this:
with this:
All this code makes my debugging server to find client content in right places. Also I need to transpile server for every code change in server scripts. That's why I go back to gulp file and replace modify code in
watch
task. I replace this:with this:
Finally I have to create
Run Configuration
, where start up file will be.tmpsrv\server\index.js
, startup task will begulp:serve:ide
(or you can run it manually). Also you have to setNODE_ENV=developmentIde
for this run configuration. And during debug sessiongulp:watch
task should work. Everything is working. Now you can debug this in WebStorm. But I am newbee in all that NodeJS and gulp stuff. Can somebody look at my modifications and propose better solutions? It is really a lot of things to modify. Maybe somebody will use it