How to debug using npm run scripts from VSCode?

后端 未结 7 1053
小鲜肉
小鲜肉 2020-12-12 23:55

I was previously using gulp and running gulp to start my application and listeners from the Visual Studio Code debugger but have recently needed to switch to running scripts

7条回答
  •  自闭症患者
    2020-12-13 00:14

    NPM scripts and gulp is not really meant for launching your application, but rather for running tasks like compilation. If it is a node application, I would recommend you to configure your launch.json that way without npm. If you have complicated listeners or process managers like PM2, instead start your application manually from the process manager and then use an Attach configuration.

    For npm tasks, you can specify a tasks.json with "command": "npm" and "args": ["run"].

提交回复
热议问题