Webstorm, launch application in watch mode and debug it
I'm wondering if there is any way in Webstorm to debug a web application launched in watch mode ? For example in a Vue.js application I've a `serve` script that launch the app and watch for change. So I try to create a new debug configuration, a JavaScript one to attach to Chrome, and I add a before launch task to run the `serve` script before opening the browser. But this doesn't work since the script is in watch mode it wait for changes and the browser never start...
Is there any solution to this problem ? Being able to start debug in watch mode and opening the browser all in the same place ?
Thanks
Please sign in to leave a comment.
Sure - just remove your script from Before launch, start it separately. A process added to Before launch has to return an exit code, the main process is waiting for its exit code to start and thus doesn't start until the first process terminates. This is the way Before launch is designed - it's supposed to be used to run some sort of pre-processing before running the main process. But
vue-cli-service servedoesn't exit, it starts the server your application is hosted on, and it has to be running to make your application work.So, just run the app first using
npm serveand then start the JavaScript debug run configurtion as described in https://blog.jetbrains.com/webstorm/2018/01/working-with-vue-js-in-webstorm/, Debugging the app sectionHi Elena, thank's for your answer.
I knew that I could do that and I was probably not clear enough but my point is that I want to do everything with just one click without having to open a terminal on the side to serve my app do you understand ?
You don't need opening terminal,
npm servecan be run with NPM run configuration; but adding it to Before launch won't work for the reason explained aboveYou can use the Compound configuration to start both npm script and Javascript Debug run configuration concurrently
Compound configuration looks like a great solution for my case.
Thank's a lot for your help